From patchwork Thu Jan 22 20:03:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 5687781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87971C058D for ; Thu, 22 Jan 2015 20:04:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA328201DD for ; Thu, 22 Jan 2015 20:04:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70C922014A for ; Thu, 22 Jan 2015 20:04:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YENwF-0001WY-D6; Thu, 22 Jan 2015 20:01:11 +0000 Received: from exprod5og126.obsmtp.com ([64.18.0.251] helo=mail-pa0-f52.google.com) by bombadil.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YENwB-0001Ra-Tv for linux-arm-kernel@lists.infradead.org; Thu, 22 Jan 2015 20:01:08 +0000 Received: from mail-pa0-f52.google.com ([209.85.220.52]) (using TLSv1) by exprod5ob126.postini.com ([64.18.4.12]) with SMTP ID DSNKVMFW7JUrT0mb1uQI/ZGNKKwDDXPEvemq@postini.com; Thu, 22 Jan 2015 12:01:07 PST Received: by mail-pa0-f52.google.com with SMTP id kx10so3841279pab.11 for ; Thu, 22 Jan 2015 12:00:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LJnSgUA84s9XucIIzfJHFu9kPm0EY9M5wmr9530YNAs=; b=OtNnp+URRvW4GdLSxQEnJi/gzjMBzsJ65440cw8TL75Gfc3jYfGoc0o8l21b553e84 OxPriKrDVdUtqaWLI4Mt0DDqXuOTJczirwgyeJun4mSxWDL5+gZY/ryMFxgoLnq2QVVp ARlhGlfmFf+zaOFsK7WG2wm2ZyVF3BLc6lY8ChfpzaxeewxUmDdzHOhkuOdwNdJV6x5b lBh9XKsykT9r+3vCcyyRuDkcLip8tavsY76AV5mHCvv5nmiUfU97LTPKZJsJRYFLjLFF yDpkDzDk4t1MVCtAKFsVYrr4zZphvt4YFlt+1V+jPFEpbcGn5mL43Cb15PK/WbvZY+3e Vdlg== X-Gm-Message-State: ALoCoQky2QEg9hRnh03Vp3zu+J/Xg9rAYJ7Gi1jNLggOqTXoqW53E+SnBUpi07cTHLSWdKpIKkLeX4M+IWvkBYgTx9weuYBVnWOxSOpCAm/MkYik6QXhksvOclK7LHQV4Q4e5ShaqxjjdhorAjHBY32obosTQd3CKbbHkHpYkKZfhBAK0n1cDxU= X-Received: by 10.70.118.202 with SMTP id ko10mr5278623pdb.48.1421956843948; Thu, 22 Jan 2015 12:00:43 -0800 (PST) X-Received: by 10.70.118.202 with SMTP id ko10mr5278578pdb.48.1421956843686; Thu, 22 Jan 2015 12:00:43 -0800 (PST) Received: from svdclab-13-11.amcc.com (67-207-112-226.static.wiline.com. [67.207.112.226]) by mx.google.com with ESMTPSA id je4sm9675343pbd.94.2015.01.22.12.00.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Jan 2015 12:00:41 -0800 (PST) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH] drivers: net: xgene: fix: Out of order descriptor bytes read Date: Thu, 22 Jan 2015 12:03:27 -0800 Message-Id: <1421957007-720-1-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150122_120108_035966_FF3CC3F8 X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) Cc: mlangsdo@redhat.com, patches@apm.com, linux-kernel@vger.kernel.org, Iyappan Subramanian , Keyur Chudgar , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the following kernel crash, WARNING: CPU: 2 PID: 0 at net/ipv4/tcp_input.c:3079 tcp_clean_rtx_queue+0x658/0x80c() Call trace: [] dump_backtrace+0x0/0x184 [] show_stack+0x10/0x1c [] dump_stack+0x74/0x98 [] warn_slowpath_common+0x88/0xb0 [] warn_slowpath_null+0x14/0x20 [] tcp_clean_rtx_queue+0x654/0x80c [] tcp_ack+0x454/0x688 [] tcp_rcv_established+0x4a4/0x62c [] tcp_v4_do_rcv+0x16c/0x350 [] tcp_v4_rcv+0x8e8/0x904 [] ip_local_deliver_finish+0x100/0x26c [] ip_local_deliver+0xac/0xc4 [] ip_rcv_finish+0xe8/0x328 [] ip_rcv+0x24c/0x38c [] __netif_receive_skb_core+0x29c/0x7c8 [] __netif_receive_skb+0x28/0x7c [] netif_receive_skb_internal+0x5c/0xe0 [] napi_gro_receive+0xb4/0x110 [] xgene_enet_process_ring+0x144/0x338 [] xgene_enet_napi+0x1c/0x50 [] net_rx_action+0x154/0x228 [] __do_softirq+0x110/0x28c [] irq_exit+0x8c/0xc0 [] handle_IRQ+0x44/0xa8 [] gic_handle_irq+0x38/0x7c [...] Software writes poison data into the descriptor bytes[15:8] and upon receiving the interrupt, if those bytes are overwritten by the hardware with the valid data, software also reads bytes[7:0] and executes receive/tx completion logic. If the CPU executes the above two reads in out of order fashion, then the bytes[7:0] will have older data and causing the kernel panic. We have to force the order of the reads and thus this patch introduces read memory barrier between these reads. Signed-off-by: Iyappan Subramanian Signed-off-by: Keyur Chudgar Tested-by: Mark Langsdorf --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 83a5028..3622cdb 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -369,6 +369,8 @@ static int xgene_enet_process_ring(struct xgene_enet_desc_ring *ring, if (unlikely(xgene_enet_is_desc_slot_empty(raw_desc))) break; + /* read fpqnum field after dataaddr field */ + smp_rmb(); if (is_rx_desc(raw_desc)) ret = xgene_enet_rx_frame(ring, raw_desc); else