netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [HELP] ATM: mpc, use-after-free
@ 2010-10-11  7:56 Jiri Slaby
  2010-10-11  8:18 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2010-10-11  7:56 UTC (permalink / raw)
  To: David S. Miller; +Cc: ML netdev, linux-atm-general, LKML, chas

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?

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

thanks,
-- 
js

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-11 18:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11  7:56 [HELP] ATM: mpc, use-after-free Jiri Slaby
2010-10-11  8:18 ` Eric Dumazet
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

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).