Skip to content

Commit 84e2b33

Browse files
liujian56Nobody
authored and
Nobody
committed
net: Enlarge offset check value from 0xffff to 0x7fffffff in bpf_skb_load_bytes
The data length of skb frags + frag_list may be greater than 0xffff, and skb_header_pointer can not handle negative offset and negative len. So here 0x7ffffff is used to check the validity of offset and len. Fixes: 05c74e5 ("bpf: add bpf_skb_load_bytes helper") Signed-off-by: Liu Jian <[email protected]>
1 parent cdde320 commit 84e2b33

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ BPF_CALL_4(bpf_skb_load_bytes, const struct sk_buff *, skb, u32, offset,
17221722
{
17231723
void *ptr;
17241724

1725-
if (unlikely(offset > 0xffff))
1725+
if (unlikely(offset > 0x7ffffffff || len > 0x7fffffff))
17261726
goto err_clear;
17271727

17281728
ptr = skb_header_pointer(skb, offset, len, to);

0 commit comments

Comments
 (0)