Files
linux/net/core
Cong Wang 997cf2d8c2 bpf: Check negative offsets in __bpf_skb_min_len()
[ Upstream commit 9ecc4d858b ]

skb_network_offset() and skb_transport_offset() can be negative when
they are called after we pull the transport header, for example, when
we use eBPF sockmap at the point of ->sk_data_ready().

__bpf_skb_min_len() uses an unsigned int to get these offsets, this
leads to a very large number which then causes bpf_skb_change_tail()
failed unexpectedly.

Fix this by using a signed int to get these offsets and ensure the
minimum is at least zero.

Fixes: 5293efe62d ("bpf: add bpf_skb_change_tail helper")
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20241213034057.246437-2-xiyou.wangcong@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-02 10:34:11 +01:00
..
2024-06-24 16:41:23 -07:00
2024-09-11 20:44:32 -07:00
2024-03-07 21:12:41 -08:00
2024-04-01 10:49:28 +01:00
2024-09-11 20:44:31 -07:00
2024-06-06 11:52:52 +02:00
2024-08-26 09:37:23 -07:00