On 9/2/20 11:06 AM, Magnus Karlsson wrote:
Fix possible segfault when entry is inserted into xskmap. This can happen if the socket is in a state where the umem has been set up, the Rx ring created but it has yet to be bound to a device. In this case the pool has not yet been created and we cannot reference it for the existence of the fill ring. Fix this by removing the whole xsk_is_setup_for_bpf_map function. Once upon a time, it was used to make sure that the Rx and fill rings where set up before the driver could call xsk_rcv, since there are no tests for the existence of these rings in the data path. But these days, we have a state variable that we test instead. When it is XSK_BOUND, everything has been set up correctly and the socket has been bound. So no reason to have the xsk_is_setup_for_bpf_map function anymore. Signed-off-by: Magnus Karlsson <magnus.karlsson@xxxxxxxxx> Reported-by: syzbot+febe51d44243fbc564ee@xxxxxxxxxxxxxxxxxxxxxxxxx Fixes: 7361f9c3d719 ("xsk: move fill and completion rings to buffer pool")
Applied & corrected Fixes tag, thanks!