]> www.infradead.org Git - users/jedix/linux-maple.git/commit
packet: fix races in fanout_add()
authorEric Dumazet <edumazet@google.com>
Tue, 14 Feb 2017 17:03:51 +0000 (09:03 -0800)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Thu, 16 Nov 2017 21:04:53 +0000 (13:04 -0800)
commit8331671104bba215384f42be7684f13eb7cadd36
treec962e608355d634d7dfb7e738dbe3a082baa6f49
parent717d3815c4273e4d87606559269553cf45295c22
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: dc99f600698d ("packet: Add fanout support.")
Fixes: 0648ab70afe6 ("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>
(cherry picked from commit d199fab63c11998a602205f7ee7ff7c05c97164b)

Orabug: 27050772
CVE: CVE-2017-15649

Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
 Conflicts:
net/packet/af_packet.c

Left out the changes related to rollover
net/packet/af_packet.c