From mboxrd@z Thu Jan 1 00:00:00 1970 From: PanBian Subject: Re: [PATCH] amd-xgbe: set skb to NULL after freeing it Date: Thu, 29 Nov 2018 15:37:56 +0800 Message-ID: <20181129073756.GA73287@bp> References: <1543392585-17962-1-git-send-email-bianpan2016@163.com> <20181128.104931.1898736297454841540.davem@davemloft.net> Reply-To: PanBian Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: thomas.lendacky@amd.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: David Miller Return-path: Content-Disposition: inline In-Reply-To: <20181128.104931.1898736297454841540.davem@davemloft.net> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.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