• E
    netlink: fix netlink_change_ngroups() · 5c398dc8
    Eric Dumazet 提交于
    commit 6c04bb18 (netlink: use call_rcu for netlink_change_ngroups)
    used a somewhat convoluted and racy way to perform call_rcu().
    
    The old block of memory is freed after a grace period, but the rcu_head
    used to track it is located in new block.
    
    This can clash if we call two times or more netlink_change_ngroups(),
    and a block is freed before another. call_rcu() called on different cpus
    makes no guarantee in order of callbacks.
    
    Fix this using a more standard way of handling this : Each block of
    memory contains its own rcu_head, so that no 'use after free' can
    happens.
    Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
    CC: Johannes Berg <johannes@sipsolutions.net>
    CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    5c398dc8
af_netlink.c 48.2 KB