• Eric Dumazet's avatar
    packet: fix races in fanout_add() · d199fab6
    Eric Dumazet authored
    Multiple threads can call fanout_add() at the same time.
    
    We need to grab fanout_mutex earlier to avoid races that could
    lead to one thread freeing po->rollover that was set by another thread.
    
    Do the same in fanout_release(), for peace of mind, and to help us
    finding lockdep issues earlier.
    
    Fixes: dc99f600 ("packet: Add fanout support.")
    Fixes: 0648ab70 ("packet: rollover prepare: per-socket state")
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d199fab6
af_packet.c 105 KB