]> git.baikalelectronics.ru Git - kernel.git/commit
xsk: do not call synchronize_net() under RCU read lock
authorBjörn Töpel <bjorn.topel@intel.com>
Mon, 8 Oct 2018 17:40:16 +0000 (19:40 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 11 Oct 2018 08:19:01 +0000 (10:19 +0200)
commit0cda4670000511ced6017a5f16ac946a9055099e
treeb63781801b81ccc68cda0d24417764e90ec138c1
parent3bc7e146a4524082b0f74561974a33a76156cbcb
xsk: do not call synchronize_net() under RCU read lock

The XSKMAP update and delete functions called synchronize_net(), which
can sleep. It is not allowed to sleep during an RCU read section.

Instead we need to make sure that the sock sk_destruct (xsk_destruct)
function is asynchronously called after an RCU grace period. Setting
the SOCK_RCU_FREE flag for XDP sockets takes care of this.

Fixes: 052e8f1622ae ("bpf: introduce new bpf AF_XDP map type BPF_MAP_TYPE_XSKMAP")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/xskmap.c
net/xdp/xsk.c