]> 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)
commit2332ac80f7251153dbfff45720f9a34051c03a19
treeb63781801b81ccc68cda0d24417764e90ec138c1
parent3b3a0744862f6cbe3bee3e8248dbf73c4e20bb5b
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: 221f0a0ce091 ("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