diff options
author | Willem de Bruijn <willemb@google.com> | 2019-05-31 12:37:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-11 12:19:11 +0200 |
commit | f2bba1f6379f4c0fe6a203b56b700f587d02be66 (patch) | |
tree | 01119e28ff587956f2854db9d8ce9d4ffffc2812 /net/packet | |
parent | bab4057c77a4195f11af2c59f4f68d426fe31722 (diff) | |
download | linux-stable-f2bba1f6379f4c0fe6a203b56b700f587d02be66.tar.gz linux-stable-f2bba1f6379f4c0fe6a203b56b700f587d02be66.tar.bz2 linux-stable-f2bba1f6379f4c0fe6a203b56b700f587d02be66.zip |
packet: unconditionally free po->rollover
[ Upstream commit afa0925c6fcc6a8f610e996ca09bc3215048033c ]
Rollover used to use a complex RCU mechanism for assignment, which had
a race condition. The below patch fixed the bug and greatly simplified
the logic.
The feature depends on fanout, but the state is private to the socket.
Fanout_release returns f only when the last member leaves and the
fanout struct is to be freed.
Destroy rollover unconditionally, regardless of fanout state.
Fixes: 57f015f5eccf2 ("packet: fix crash in fanout_demux_rollover()")
Reported-by: syzbot <syzkaller@googlegroups.com>
Diagnosed-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 59da6f5b717d..71d5544243d2 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -3016,8 +3016,8 @@ static int packet_release(struct socket *sock) synchronize_net(); + kfree(po->rollover); if (f) { - kfree(po->rollover); fanout_release_data(f); kfree(f); } |