bpf: fix bpf_skb_load_bytes_relative pkt length check
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 27 Jul 2018 22:17:56 +0000 (00:17 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 28 Jul 2018 19:23:24 +0000 (21:23 +0200)
commit3eee1f75f2b9c107d4a097e8b640553376a5b171
tree0c9e6251bb0b5bea11e54fe4c69b679c89fa46a4
parentb611da43b68193dcb7e632adb44d506374a5d3ef
bpf: fix bpf_skb_load_bytes_relative pkt length check

The len > skb_headlen(skb) cannot be used as a maximum upper bound
for the packet length since it does not have any relation to the full
linear packet length when filtering is used from upper layers (e.g.
in case of reuseport BPF programs) as by then skb->data, skb->len
already got mangled through __skb_pull() and others.

Fixes: 4e1ec56cdc59 ("bpf: add skb_load_bytes_relative helper")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
net/core/filter.c