]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: fix race on generic receive path
authorIlya Maximets <i.maximets@samsung.com>
Wed, 3 Jul 2019 12:09:16 +0000 (15:09 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Jul 2019 23:43:26 +0000 (01:43 +0200)
commit481935046808d1b70a7f4bf3b09da406fd35d374
tree596c5002c0217bb4c9ab8e1ea2fbf49cf0e78f75
parent6da034741ca7baac4347f54d200a17021dd33411
xdp: fix race on generic receive path

Unlike driver mode, generic xdp receive could be triggered
by different threads on different CPU cores at the same time
leading to the fill and rx queue breakage. For example, this
could happen while sending packets from two processes to the
first interface of veth pair while the second part of it is
open with AF_XDP socket.

Need to take a lock for each generic receive to avoid race.

Fixes: 85872f4e67cd ("xsk: add Rx receive functions and poll support")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Tested-by: William Tu <u9012063@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/net/xdp_sock.h
net/xdp/xsk.c