]> git.baikalelectronics.ru Git - kernel.git/commit
packet: avoid panic in packet_getsockopt()
authorEric Dumazet <edumazet@google.com>
Wed, 18 Oct 2017 23:14:52 +0000 (16:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Oct 2017 00:51:34 +0000 (01:51 +0100)
commit816ff8ad61951ba26602bac05033ed78da528c3f
treef9dcb3f8a8782f6c6bbc6231e9eea2382146d36b
parent6b5ce7d0dd330e54a6b5bfcdcfdcf3d440fcfed4
packet: avoid panic in packet_getsockopt()

syzkaller got crashes in packet_getsockopt() processing
PACKET_ROLLOVER_STATS command while another thread was managing
to change po->rollover

Using RCU will fix this bug. We might later add proper RCU annotations
for sparse sake.

In v2: I replaced kfree(rollover) in fanout_add() to kfree_rcu()
variant, as spotted by John.

Fixes: c0e791fc81b0 ("packet: rollover statistics")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: John Sperbeck <jsperbeck@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c