]> git.baikalelectronics.ru Git - kernel.git/commit
xsk: Fix for xp_aligned_validate_desc() when len == chunk_size
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Wed, 28 Apr 2021 09:44:24 +0000 (17:44 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 3 May 2021 22:28:06 +0000 (00:28 +0200)
commitdff37a9ab560522d9395f66cfe95dbac662fe855
tree8359163fe639b92bb0dfcedc3530450c765ed386
parent9366bdb6d4503bdbf7c1601068065ded254b839a
xsk: Fix for xp_aligned_validate_desc() when len == chunk_size

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 5c50728312d3 ("xsk: new descriptor
addressing scheme"). Later in d9ed155ea143 ("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 71a80efd1167 ("xsk: Explicitly inline functions and move definitions").

Fixes: 5c50728312d3 ("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
net/xdp/xsk_queue.h