Commit 57ffb0e
packet: avoid panic in packet_getsockopt()
[ Upstream commit 509c7a1 ]
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: a9b6391 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 2ffd261 commit 57ffb0e
1 file changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1720 | 1720 | | |
1721 | 1721 | | |
1722 | 1722 | | |
1723 | | - | |
| 1723 | + | |
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
| |||
1747 | 1747 | | |
1748 | 1748 | | |
1749 | 1749 | | |
1750 | | - | |
| 1750 | + | |
1751 | 1751 | | |
| 1752 | + | |
| 1753 | + | |
1752 | 1754 | | |
1753 | 1755 | | |
1754 | 1756 | | |
| |||
3851 | 3853 | | |
3852 | 3854 | | |
3853 | 3855 | | |
| 3856 | + | |
3854 | 3857 | | |
3855 | 3858 | | |
3856 | 3859 | | |
| |||
3929 | 3932 | | |
3930 | 3933 | | |
3931 | 3934 | | |
3932 | | - | |
| 3935 | + | |
| 3936 | + | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
| 3945 | + | |
3933 | 3946 | | |
3934 | | - | |
3935 | | - | |
3936 | | - | |
3937 | | - | |
3938 | | - | |
3939 | 3947 | | |
3940 | 3948 | | |
3941 | 3949 | | |
| |||
0 commit comments