public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	ML netdev <netdev@vger.kernel.org>,
	linux-atm-general@lists.sourceforge.net,
	LKML <linux-kernel@vger.kernel.org>,
	chas@cmf.nrl.navy.mil
Subject: Re: [HELP] ATM: mpc, use-after-free
Date: Mon, 11 Oct 2010 10:18:00 +0200	[thread overview]
Message-ID: <1286785081.2737.2.camel@edumazet-laptop> (raw)
In-Reply-To: <4CB2C33C.8080109@gmail.com>

Le lundi 11 octobre 2010 à 09:56 +0200, Jiri Slaby a écrit :
> Hi,
> 
> Stanse found this use-after-free:
> 
> static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
> {
> ...
>         new_skb = skb_realloc_headroom(skb, eg->ctrl_info.DH_length);
> 
>         dev_kfree_skb_any(skb);
> 
> FREE    ^^^^^^^^^^^^^^^^^^^^^^^
> 
>         if (new_skb == NULL) {
>                 mpc->eg_ops->put(eg);
>                 return;
>         }
>         skb_push(new_skb, eg->ctrl_info.DH_length);
>         skb_copy_to_linear_data(new_skb, eg->ctrl_info.DLL_header,
>                                 eg->ctrl_info.DH_length);
>  ...
>         memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
> 
> USE            ^^^^^^^^^^^^
> 
>         netif_rx(new_skb);
> 
> I guess it should be ATM_SKB(new_skb), right?

Yes

-	memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
+	memset(ATM_SKB(new_skb), 0, sizeof(struct atm_skb_data));

> 
> The two problems are:
> 1) obvious use-after-free
> 2) ?data leak, since we don't erase the right memory?
> 
> thanks,

Indeed, please submit a formal patch ?

Thanks



  reply	other threads:[~2010-10-11  8:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11  7:56 [HELP] ATM: mpc, use-after-free Jiri Slaby
2010-10-11  8:18 ` Eric Dumazet [this message]
2010-10-11  8:46   ` [PATCH 1/1] ATM: mpc, fix use after free Jiri Slaby
2010-10-11  8:59     ` Eric Dumazet
2010-10-11 18:12       ` 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=1286785081.2737.2.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=davem@davemloft.net \
    --cc=jirislaby@gmail.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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