Commit afa0925c authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

packet: unconditionally free po->rollover

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>
parent 8c268598
......@@ -3014,8 +3014,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