Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2150163imu; Wed, 28 Nov 2018 23:39:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/XA/LvnV7XJ7uy74p3lKoXef5Dcgo8jVLmei50FcqF079j2g92h1IWEnFi8JNUAekfhSe2E X-Received: by 2002:a62:2cf:: with SMTP id 198mr395910pfc.67.1543477186733; Wed, 28 Nov 2018 23:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543477186; cv=none; d=google.com; s=arc-20160816; b=HI25sPHaVzkx+2DfPdCpF2bEiHCTqkommVvXFD8OL+pHAAwhz3tTsQ7WwKPr3FzfwX 5FH6GcSe03w/Jmb4PQGmRe0AmR1Dx2fKQt0s/L2a7Bhe6xCdsxZj14k9V1iPzdCGjRTN qhP/jjqJmGWqIGPnXgHxeBQt1jKMUdqicx8JOo+Q+sTcM9gjVHYAkdaM4GZW9Z0xFPyv PTBweoau7sHwO1HM7XDC/Al8zMzYjsSuchHx8jKn4z0nej0bNMimSCDMdTRoYkrUOuYj y+Ho74Op8pcKglTNt3B+Z4mSneX71bTQgUXoCWselAc88zqi7nfvaUtSIBjLLCwwa0NQ BApg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Fva0upsThI9/5B/dKzbVzKIt0VO+FAZlovF3pRRZcnM=; b=eFze1kmtZkc4m8TzvTPQ7AmYTESQzfRq/6kipHhgVgQkyW5eCQLgGkHXiLmwJqdoDw BEFt4duOGTL1vkjxnfUi2aKmOHdKEIXmg/3j4NELP8IUFJVKjyOaNs89d5bwfmmPvzuV KwbZ4WBECrzsCBtg0SfPE+A7c/314dG2Swm99VH6B3ZFmH1vbXZuRQU1AnuBH8FXELNm yJQU/NLnP0A++6Oq7HW7BpXRgW8Ex3v6fIZ+YYDqvBPGM5WiohhUEW/Ez4we/NlN6YSq gLtrcpKfrHsc4Nff3fzW8wchFv8z5cqwdTLLsGXycb+NXyizXH0ff0m5OWyfKvV4LWx7 PW6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=HBHiuNdy; 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 y7si1241753pgc.236.2018.11.28.23.39.31; Wed, 28 Nov 2018 23:39:46 -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=HBHiuNdy; 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 S1727535AbeK2Sma (ORCPT + 99 others); Thu, 29 Nov 2018 13:42:30 -0500 Received: from m12-15.163.com ([220.181.12.15]:42019 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726587AbeK2Sma (ORCPT ); Thu, 29 Nov 2018 13:42:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=Fva0u psThI9/5B/dKzbVzKIt0VO+FAZlovF3pRRZcnM=; b=HBHiuNdyJUPoiUhA3OTdO O0XntqpN5KEpBMRnggtSDIqKFfqNKpF1zI5J5TeAywt5XV3ouaQzh5xqYkgPYs28 g0+yEbmErE1DE+WXrcwJZ8cLRaBzJdgx8T+Z1ejTROSJ0PpU4CfXTdd20iZaIQ4q FbxTI30vfkOV6g3/gwPIxk= Received: from bp (unknown [106.120.213.96]) by smtp11 (Coremail) with SMTP id D8CowABniS1Rl_9b5izuAQ--.18628S2; Thu, 29 Nov 2018 15:37:53 +0800 (CST) Date: Thu, 29 Nov 2018 15:37:56 +0800 From: PanBian To: David Miller Cc: thomas.lendacky@amd.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] amd-xgbe: set skb to NULL after freeing it Message-ID: <20181129073756.GA73287@bp> Reply-To: PanBian References: <1543392585-17962-1-git-send-email-bianpan2016@163.com> <20181128.104931.1898736297454841540.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181128.104931.1898736297454841540.davem@davemloft.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-CM-TRANSID: D8CowABniS1Rl_9b5izuAQ--.18628S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4xGryxKrWxKr4fXFWDurg_yoWfXFb_Wr ykX3WkCw1DCasrGF4ftrWfXwn3Ga1UGry0qw48XrsFvr9xJrZ3C3ykWrnYgryxu392kF1U GFn5Za97uw13ujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUntku7UUUUU== X-Originating-IP: [106.120.213.96] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBUREOclaD0WuU1QAAsS Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 10:49:31AM -0800, David Miller wrote: > From: Pan Bian > Date: Wed, 28 Nov 2018 16:09:45 +0800 > > If either of these two cases are executed, it means that it must be > the case that: > > !last || context_next > > is FALSE, therefore the conditional in the tail code of this function: > > /* Check if we need to save state before leaving */ > if (received && (!last || context_next)) { > rdata = XGBE_GET_DESC_DATA(ring, ring->cur); > rdata->state_saved = 1; > rdata->state.skb = skb; > rdata->state.len = len; > rdata->state.error = error; > } > > will not trigger, and therefore we will not record the free'd SKB. > > And if we iterate the loop again, it is guaranteed that 'skb' will > be set to a new packet or NULL. > > So there is no problem here. Got it. Sorry for my misunderstanding. Thank you and Tom for the detailed explanations. Pan