提交 1037d951 编写于 作者: W Willem de Bruijn 提交者: Xie XiuQi

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: 57f015f5 ("packet: fix crash in fanout_demux_rollover()")
Reported-by: Nsyzbot <syzkaller@googlegroups.com>
Diagnosed-by: NDmitry Vyukov <dvyukov@google.com>
Signed-off-by: NWillem de Bruijn <willemb@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 75bd2555
......@@ -3017,8 +3017,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册