]> git.baikalelectronics.ru Git - kernel.git/commit
xsk: Add missing check on user supplied headroom size
authorMagnus Karlsson <magnus.karlsson@intel.com>
Tue, 14 Apr 2020 07:35:15 +0000 (09:35 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 15 Apr 2020 11:07:18 +0000 (13:07 +0200)
commit73256f1c3d39a30876ee20a34242501d149ca2e9
tree14527dbe4aed7324672dfc119739886f523697d0
parentcc9aabba9df1934b480e8af2a4fb1b0240c7bada
xsk: Add missing check on user supplied headroom size

Add a check that the headroom cannot be larger than the available
space in the chunk. In the current code, a malicious user can set the
headroom to a value larger than the chunk size minus the fixed XDP
headroom. That way packets with a length larger than the supported
size in the umem could get accepted and result in an out-of-bounds
write.

Fixes: 5fb4c4086995 ("xsk: add user memory registration support sockopt")
Reported-by: Bui Quang Minh <minhquangbui99@gmail.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=207225
Link: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com
net/xdp/xdp_umem.c