Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1852568imu; Wed, 28 Nov 2018 16:40:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wtlv46bILTuaBeNbtyKBSf8fv4ZJA04usIEFg+EdZUHz9aXqGVcLegOTUB9vX4PvtzcNnV X-Received: by 2002:a63:e20a:: with SMTP id q10mr34167215pgh.206.1543452012323; Wed, 28 Nov 2018 16:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543452012; cv=none; d=google.com; s=arc-20160816; b=PAwnPm+CyUSOLGi1ikNvbuv+dvzRTUE0X2pvqCGOHnECeCtgL7EwZ6cESJNIPvo8Hy 4t3D9i/bb6gULFlSqX/0tnSFoWJzjHS5NLTahKh1FDRXn89iYOqe09ysEGq5IutNOPWR GKXT/rjY/5efu0LSGoYZ3HKbPQCbd19XsSC3Rjak+GX11qtkeJ2ayG/x4Nfssg9Exsa0 RPIPmUZoX0BDmwnelGf00vEDUipvr9BYTDhTyGxqmMIeg2ZcyANMbIqFP0tvDieWcpWC z+w2LmKm2pPc3NaWgmC/CLhm1Z8278OX60r7N3CjRy6vEq5igLMMSjwDCQDfQuiPYq79 SijQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=mV9PGtULwc+fD54lMGrsYSEqRHO3KwMMrP0Jsw4kLbI=; b=TTq9NUWqtre2dPJTkIhB24K9c5cawQ9PO/L+MvdOVNj50JCoe3n5/jxNmFesEul25H QyZHmsxwYIAH2rYMSxiuAxuDIY2aBR9OyQxP1lgs0Or3RsojMxWKqNEAIE1u4m7lneX/ ZHnUu4ZWdgEzuYn26/n/9Eyvf3g8fGk+qT6r8PhsjtB0x6ywNP3YMy0Drkum7RCNzQA3 lbbC7/NdWaYNSRFN5YSvQLiVKgyK/mHULAHI1EnO46LGMoHrwX5KrBIIX2Hb7OsKaojN x1+COGGblXuSpYvfNNuUKEnMavg0V5JVZwexQCDMGozovZrtJM5lnR2vov2zPED4EVv4 yQ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Y75nl5yQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si221588plb.209.2018.11.28.16.39.57; Wed, 28 Nov 2018 16:40:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Y75nl5yQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbeK2K55 (ORCPT + 99 others); Thu, 29 Nov 2018 05:57:57 -0500 Received: from m12-17.163.com ([220.181.12.17]:60065 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbeK2K55 (ORCPT ); Thu, 29 Nov 2018 05:57:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=mV9PGtULwc+fD54lMG rsYSEqRHO3KwMMrP0Jsw4kLbI=; b=Y75nl5yQLthhBD5oTuGdMFFitcKwdhmZGv U/+fTLoGqqlbfLliC8LPyQWZvEFYIVzudLJDw+q9RbOO4/Yok2duG12wxe791qau uOh8V4eC9CBW56ycSTjpLVRXu1j2XDlp2xR/gtV6UXQdN77GZO2x/RDXZWF02W+W 78j8a6u6w= Received: from bp.localdomain (unknown [106.120.213.96]) by smtp13 (Coremail) with SMTP id EcCowADnrFisKv9bKWwrCA--.35120S3; Thu, 29 Nov 2018 07:54:26 +0800 (CST) From: Pan Bian To: Derek Chickles , Satanand Burla , Felix Manlunas , Raghu Vatsavayi , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH net] liquidio: read sc->iq_no before release sc Date: Thu, 29 Nov 2018 07:54:22 +0800 Message-Id: <1543449262-70421-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: EcCowADnrFisKv9bKWwrCA--.35120S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7tFyfZw47XrWxuF17tFW5KFg_yoW8Gr4kpr y8Jry2kr97JF18ua1DJr48WF93Ka1kta4YkFWfG3s3J3Z8JFyIgFy0yFyYyrWDurWkuF4S yFWDCa17XFn5A37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j6UDJUUUUU= X-Originating-IP: [106.120.213.96] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBURMNclaD0WaTOwAAs3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function lio_vf_rep_packet_sent_callback releases the occupation of sc via octeon_free_soft_command. sc should not be used after that. Unfortunately, sc->iq_no is read. To fix this, the patch stores sc->iq_no into a local variable before releasing sc and then uses the local variable instead of sc->iq_no. Signed-off-by: Pan Bian --- drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c index ea9859e..de61060 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c @@ -349,13 +349,15 @@ lio_vf_rep_packet_sent_callback(struct octeon_device *oct, struct octeon_soft_command *sc = (struct octeon_soft_command *)buf; struct sk_buff *skb = sc->ctxptr; struct net_device *ndev = skb->dev; + u32 iq_no; dma_unmap_single(&oct->pci_dev->dev, sc->dmadptr, sc->datasize, DMA_TO_DEVICE); dev_kfree_skb_any(skb); + iq_no = sc->iq_no; octeon_free_soft_command(oct, sc); - if (octnet_iq_is_full(oct, sc->iq_no)) + if (octnet_iq_is_full(oct, iq_no)) return; if (netif_queue_stopped(ndev)) -- 2.7.4