summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-01 19:05:32 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 00:10:40 +0000
commit95f1d5e4abb79fe85a54f7a46b41f297ce533c31 (patch)
treef80a2aaca276381b5d9a8eb92612128e0183a760 /scripts/basic/split-include.c
parentd9618a6196953718f7470de5d2e84121bed063f7 (diff)
downloadlinux-95f1d5e4abb79fe85a54f7a46b41f297ce533c31.tar.gz
linux-95f1d5e4abb79fe85a54f7a46b41f297ce533c31.zip
bpf: Don't let lwt_in progs call into IPv6 when it is disabled
With ipv6.disable=1, inet6_init() returns before it registers any pernet subsystem. Thus net->ipv6.devconf_all and net->ipv6.seg6_data stay NULL. IS_ENABLED(CONFIG_IPV6) only says that the code is built in. bpf_lwt_input_reroute() and bpf_push_seg6_encap() call into IPv6, but do not test ipv6_mod_enabled(). An lwt_in prog also runs with ipv6.disable=1, and skb->protocol == htons(ETH_P_IPV6) does not prove that IPv6 is enabled. Thus the kernel dereferences NULL and crashes. Return -EAFNOSUPPORT before these calls if ipv6_mod_enabled() is false. BPF_LWT_REROUTE then drops an IPv6 skb. With IPv6 enabled nothing changes. The first Fixes tag is for bpf_push_seg6_encap(), which never had this test. The second tag is for bpf_lwt_input_reroute(). Until that commit it used ipv6_stub, which returned -EAFNOSUPPORT with ipv6.disable=1. Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers") Fixes: ad84b1eefe28 ("bpf: remove ipv6_bpf_stub completely and use direct function calls") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261101190535.1454146-25-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions