]> git.baikalelectronics.ru Git - kernel.git/commit
packet: fix races in fanout_add()
authorEric Dumazet <edumazet@google.com>
Tue, 14 Feb 2017 17:03:51 +0000 (09:03 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Feb 2017 20:05:12 +0000 (15:05 -0500)
commit483325f502583e81386cd34b257667d501122596
tree9977e38c6afb849d7f823820b73d160092415e60
parent21f4635c57abbb16e1445c3e7312a6ae87d34cf4
packet: fix races in fanout_add()

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: 3a6d3b9a5701 ("packet: Add fanout support.")
Fixes: 60d1a3dda038 ("packet: rollover prepare: per-socket state")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c