Commit f2bba1f6 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by Greg Kroah-Hartman

packet: unconditionally free po->rollover

[ Upstream commit afa0925c ]

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: 57f015f5 ("packet: fix crash in fanout_demux_rollover()")
Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
Diagnosed-by: default avatarDmitry Vyukov <dvyukov@google.com>
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bab4057c
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment