mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
bpf: Fix bpf_xdp_pointer return pointer
[ Upstream commitbbd52178e2
] 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:3f364222d0
("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>
This commit is contained in:
parent
b338e4afc1
commit
d249081b51
1 changed files with 1 additions and 1 deletions
|
@ -3917,7 +3917,7 @@ static void *bpf_xdp_pointer(struct xdp_buff *xdp, u32 offset, u32 len)
|
|||
offset -= frag_size;
|
||||
}
|
||||
out:
|
||||
return offset + len < size ? addr + offset : NULL;
|
||||
return offset + len <= size ? addr + offset : NULL;
|
||||
}
|
||||
|
||||
BPF_CALL_4(bpf_xdp_load_bytes, struct xdp_buff *, xdp, u32, offset,
|
||||
|
|
Loading…
Reference in a new issue