]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Fix bpf_xdp_pointer return pointer
authorJoanne Koong <joannelkoong@gmail.com>
Fri, 22 Jul 2022 22:01:05 +0000 (15:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:41:11 +0000 (14:41 +0200)
commitd249081b51b930f2e35ba8a53ea4793a81fc7b84
tree74a51bd4e5c567011687574c0359a507a58e9ca8
parentb338e4afc1fe0ad94c655557bdf29ae2f25c383b
bpf: Fix bpf_xdp_pointer return pointer

[ Upstream commit bbd52178e249fe893ef4a9b87cde5b6c473b0a7c ]

For the case where offset + len == size, bpf_xdp_pointer should return a
valid pointer to the addr because that access is permitted. We should
only return NULL in the case where offset + len exceeds size.

Fixes: 3f364222d032 ("net: xdp: introduce bpf_xdp_pointer utility routine")
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/bpf/20220722220105.2065466-1-joannelkoong@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/core/filter.c