All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Zhang Shengju <zhangshengju@cmss.chinamobile.com>,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [net] net: fix double free issue of skbuff
Date: Mon, 29 Feb 2016 15:58:21 +0300	[thread overview]
Message-ID: <56D4406D.5060303@cogentembedded.com> (raw)
In-Reply-To: <1456748573-21586-1-git-send-email-zhangshengju@cmss.chinamobile.com>

Hello.

On 2/29/2016 3:22 PM, Zhang Shengju wrote:

> If skb_reorder_vlan_header() failed, skb is freed and NULL is returned.
> Then at skb_vlan_untag(), it will free skbuff again which cause double
> free.
>
> This patch removes kfree_skb() call in function skb_reorder_vlan_header().
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> ---
>   net/core/skbuff.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 488566b..1312d4b 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4350,7 +4350,6 @@ EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);
>   static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
>   {
>   	if (skb_cow(skb, skb_headroom(skb)) < 0) {
> -		kfree_skb(skb);
>   		return NULL;
>   	}

    You now need to remove {}.

MBR, Sergei

  reply	other threads:[~2016-02-29 12:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 12:22 [net] net: fix double free issue of skbuff Zhang Shengju
2016-02-29 12:58 ` Sergei Shtylyov [this message]
2016-02-29 13:10 ` Paolo Abeni
2016-02-29 17:01 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2016-02-29 14:10 张胜举
2016-02-29 14:16 张胜举
2016-02-29 17:11 ` 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=56D4406D.5060303@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=zhangshengju@cmss.chinamobile.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.