• Guillaume Chazarain's avatar
    [PKT_SCHED] netem: Fix slab corruption with netem (2nd try) · 89e1df74
    Guillaume Chazarain authored
    CONFIG_DEBUG_SLAB found the following bug:
    netem_enqueue() in sch_netem.c gets a pointer inside a slab object:
    struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb;
    But then, the slab object may be freed:
    skb = skb_unshare(skb, GFP_ATOMIC)
    cb is still pointing inside the freed skb, so here is a patch to
    initialize cb later, and make it clear that initializing it sooner
    is a bad idea.
    
    [From Stephen Hemminger: leave cb unitialized in order to let gcc
    complain in case of use before initialization]
    Signed-off-by: default avatarGuillaume Chazarain <guichaz@yahoo.fr>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    89e1df74
sch_netem.c 17.6 KB