From patchwork Wed Nov 25 17:02:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 7701551 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B47969F1BE for ; Wed, 25 Nov 2015 17:04:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9FBD207F8 for ; Wed, 25 Nov 2015 17:04:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCCFD207C5 for ; Wed, 25 Nov 2015 17:04:57 +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 1a1dSm-0007eJ-HA; Wed, 25 Nov 2015 17:02:36 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a1dSj-0007cV-GP for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2015 17:02:33 +0000 Received: by pacej9 with SMTP id ej9so62614860pac.2 for ; Wed, 25 Nov 2015 09:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; bh=1ArWs+eArTewuWJ6gp/4faIJIc+uwtsRIaAo3M0QPnc=; b=Q7eFZsIAxziolHXn24EVjImo04hr3HKKoWfU8Yt4V5/iKBAhsghJKMfg72WKg5E9Af W0kFK6J+DFFCiIX+yPfHl0QpcyWToHTRjF8+hYuqE9G0A75hq3BBvMEGlr93XsiN2jVU g6LHFVys2JXIRi5u9gh5T4WmsdtWq03RifO9sW3lmRQH8AJiYImUnIr02AfYZeHu72HP FZcpoyx0Ay8jgThVI/Tb2KUytn7o2a823H9PsFF0W1wMtSOs8ediadjM1KPjTM3fYtL8 mqSzqeFSn/o9r+nKpykgSC3URbqn425CMyZCmyUiz/6fW4Bvm/BMaR/C5ZRz1SqxzxBq 8eug== X-Received: by 10.66.228.225 with SMTP id sl1mr12656495pac.63.1448470932190; Wed, 25 Nov 2015 09:02:12 -0800 (PST) Received: from [172.26.54.208] ([172.26.54.208]) by smtp.gmail.com with ESMTPSA id fn4sm22503530pab.46.2015.11.25.09.02.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 09:02:11 -0800 (PST) Message-ID: <1448470930.24696.10.camel@edumazet-glaptop2.roam.corp.google.com> Subject: [PATCH net] drivers: net: xgene: fix possible use after free From: Eric Dumazet To: Mark Rutland , David Miller , Iyappan Subramanian Date: Wed, 25 Nov 2015 09:02:10 -0800 In-Reply-To: <20151125163402.GA29094@leverpostej> References: <20151125155753.GE12434@leverpostej> <1448468256.24696.5.camel@edumazet-glaptop2.roam.corp.google.com> <20151125163402.GA29094@leverpostej> X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151125_090233_594796_C1AEB5F8 X-CRM114-Status: GOOD ( 10.05 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ryabinin.a.a@gmail.com, isubramanian@apm.com, kchudgar@apm.com, linux-arm-kernel@lists.infradead.org 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.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Eric Dumazet Once TX has been enabled on a NIC, it is illegal to access skb, as this skb might have been freed by another cpu, from TX completion handler. Signed-off-by: Eric Dumazet Reported-by: Mark Rutland Tested-by: Mark Rutland Cc: Iyappan Subramanian Acked-by: Iyappan Subramanian --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 1adfe7036843..9147a0107c44 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -450,12 +450,12 @@ static netdev_tx_t xgene_enet_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; } - pdata->ring_ops->wr_cmd(tx_ring, count); skb_tx_timestamp(skb); pdata->stats.tx_packets++; pdata->stats.tx_bytes += skb->len; + pdata->ring_ops->wr_cmd(tx_ring, count); return NETDEV_TX_OK; }