netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: PanBian <bianpan2016@163.com>
To: David Miller <davem@davemloft.net>
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
Date: Thu, 29 Nov 2018 15:37:56 +0800	[thread overview]
Message-ID: <20181129073756.GA73287@bp> (raw)
In-Reply-To: <20181128.104931.1898736297454841540.davem@davemloft.net>

On Wed, Nov 28, 2018 at 10:49:31AM -0800, David Miller wrote:
> From: Pan Bian <bianpan2016@163.com>
> 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

      reply	other threads:[~2018-11-29  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  8:09 [PATCH] amd-xgbe: set skb to NULL after freeing it Pan Bian
2018-11-28 18:49 ` David Miller
2018-11-29  7:37   ` PanBian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181129073756.GA73287@bp \
    --to=bianpan2016@163.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).