]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat to deal with gso sctp skbs
authorDaniel Axtens <dja@axtens.net>
Sat, 3 Mar 2018 02:03:46 +0000 (03:03 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 3 Mar 2018 21:01:11 +0000 (13:01 -0800)
commit2e0356423216f20b8f1c59e5bd23dd30a29c2978
tree986c3a4022275f49fde59e84ab1435ff738b8752
parent8aa4a39b784fee5fb1744a248abe8ff2b4d9d768
bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat to deal with gso sctp skbs

SCTP GSO skbs have a gso_size of GSO_BY_FRAGS, so any sort of
unconditionally mangling of that will result in nonsense value
and would corrupt the skb later on.

Therefore, i) add two helpers skb_increase_gso_size() and
skb_decrease_gso_size() that would throw a one time warning and
bail out for such skbs and ii) refuse and return early with an
error in those BPF helpers that are affected. We do need to bail
out as early as possible from there before any changes on the
skb have been performed.

Fixes: 5a0c7185ac4f ("bpf: add bpf_skb_change_proto helper")
Co-authored-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Documentation/networking/segmentation-offloads.txt
include/linux/skbuff.h
net/core/filter.c