Commit d552c8c
packet: avoid panic in packet_getsockopt()
[ Upstream commit 509c7a1ecc8601f94ffba8a00889fefb239c00c6 ]
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 ef3a12f commit d552c8c
1 file changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
1727 | | - | |
| 1727 | + | |
1728 | 1728 | | |
1729 | 1729 | | |
1730 | 1730 | | |
| |||
1751 | 1751 | | |
1752 | 1752 | | |
1753 | 1753 | | |
1754 | | - | |
| 1754 | + | |
1755 | 1755 | | |
| 1756 | + | |
| 1757 | + | |
1756 | 1758 | | |
1757 | 1759 | | |
1758 | 1760 | | |
| |||
3769 | 3771 | | |
3770 | 3772 | | |
3771 | 3773 | | |
| 3774 | + | |
3772 | 3775 | | |
3773 | 3776 | | |
3774 | 3777 | | |
| |||
3847 | 3850 | | |
3848 | 3851 | | |
3849 | 3852 | | |
3850 | | - | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
3851 | 3864 | | |
3852 | | - | |
3853 | | - | |
3854 | | - | |
3855 | | - | |
3856 | | - | |
3857 | 3865 | | |
3858 | 3866 | | |
3859 | 3867 | | |
| |||
0 commit comments