]> 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)
commitff2ca95de4403d762290ec034a7784f4d4497fcf
tree986c3a4022275f49fde59e84ab1435ff738b8752
parenta326fa7b1c91a29d52be1fac6ff39a16f61f7f94
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: d9d6a8701ab0 ("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