linux-stable/net/xdp
Xuan Zhuo 340de910d6 xsk: Fix for xp_aligned_validate_desc() when len == chunk_size
[ Upstream commit ac31565c21 ]

When desc->len is equal to chunk_size, it is legal. But when the
xp_aligned_validate_desc() got chunk_end from desc->addr + desc->len
pointing to the next chunk during the check, it caused the check to
fail.

This problem was first introduced in bbff2f321a ("xsk: new descriptor
addressing scheme"). Later in 2b43470add ("xsk: Introduce AF_XDP buffer
allocation API") this piece of code was moved into the new function called
xp_aligned_validate_desc(). This function was then moved into xsk_queue.h
via 26062b185e ("xsk: Explicitly inline functions and move definitions").

Fixes: bbff2f321a ("xsk: new descriptor addressing scheme")
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/20210428094424.54435-1-xuanzhuo@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-19 10:13:06 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile xsk: Introduce AF_XDP buffer allocation API 2020-05-21 17:31:26 -07:00
xdp_umem.c xsk: Fix umem cleanup bug at socket destruct 2020-11-20 15:52:39 +01:00
xdp_umem.h xsk: Fix umem cleanup bug at socket destruct 2020-11-20 15:52:39 +01:00
xsk.c xsk: Respect device's headroom and tailroom on generic xmit path 2021-05-14 09:50:28 +02:00
xsk.h xsk: Fix possible segfault at xskmap entry insertion 2020-09-02 16:52:59 +02:00
xsk_buff_pool.c xsk: Fix race in SKB mode transmit with shared cq 2021-01-17 14:17:05 +01:00
xsk_diag.c xsk: Fix possible segfault in xsk umem diagnostics 2020-09-02 16:49:40 +02:00
xsk_queue.c xsk: Remove MEM_TYPE_ZERO_COPY and corresponding code 2020-05-21 17:31:27 -07:00
xsk_queue.h xsk: Fix for xp_aligned_validate_desc() when len == chunk_size 2021-05-19 10:13:06 +02:00
xskmap.c bpf: Allow for map-in-map with dynamic inner array map entries 2020-10-11 10:21:04 -07:00