Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: David Miller <davem@davemloft.net>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 8/8] xfrm: Fix potential null pointer dereference in xdst_queue_output
Date: Wed, 28 Aug 2013 04:36:27 -0700	[thread overview]
Message-ID: <1377689787.8828.179.camel@edumazet-glaptop> (raw)
In-Reply-To: <1377687895-5780-9-git-send-email-steffen.klassert@secunet.com>

On Wed, 2013-08-28 at 13:04 +0200, Steffen Klassert wrote:
> The net_device might be not set on the skb when we try refcounting.
> This leads to a null pointer dereference in xdst_queue_output().
> It turned out that the refcount to the net_device is not needed
> after all. The dst_entry has a refcount to the net_device before
> we queue the skb, so it can't go away. Therefore we can remove the
> refcount on queueing to fix the null pointer dereference.
> 
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
>  net/xfrm/xfrm_policy.c |    9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index e52cab3..f77c371 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -320,10 +320,8 @@ static void xfrm_queue_purge(struct sk_buff_head *list)
>  {
>  	struct sk_buff *skb;
>  
> -	while ((skb = skb_dequeue(list)) != NULL) {
> -		dev_put(skb->dev);
> +	while ((skb = skb_dequeue(list)) != NULL)
>  		kfree_skb(skb);
> -	}
>  }
>  

xfrm_queue_purge() now looks a lot like skb_queue_purge() ;)

  reply	other threads:[~2013-08-28 11:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 11:04 pull request (net): ipsec 2013-08-28 Steffen Klassert
2013-08-28 11:04 ` [PATCH 1/8] xfrm: make local error reporting more robust Steffen Klassert
2013-08-28 11:04 ` [PATCH 2/8] xfrm: introduce helper for safe determination of mtu Steffen Klassert
2013-08-28 11:04 ` [PATCH 3/8] ipv6: wire up skb->encapsulation Steffen Klassert
2013-08-28 11:04 ` [PATCH 4/8] ipv6: xfrm: dereference inner ipv6 header if encapsulated Steffen Klassert
2013-08-28 11:04 ` [PATCH 5/8] xfrm: choose protocol family by skb protocol Steffen Klassert
2013-08-28 11:04 ` [PATCH 6/8] xfrm: revert ipv4 mtu determination to dst_mtu Steffen Klassert
2013-08-28 11:04 ` [PATCH 7/8] ipv6: set skb->protocol on tcp, raw and ip6_append_data genereated skbs Steffen Klassert
2013-08-28 11:04 ` [PATCH 8/8] xfrm: Fix potential null pointer dereference in xdst_queue_output Steffen Klassert
2013-08-28 11:36   ` Eric Dumazet [this message]
2013-08-29  4:27     ` Steffen Klassert
2013-08-29 20:08 ` pull request (net): ipsec 2013-08-28 David Miller

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=1377689787.8828.179.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.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