]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ipv6: fix panic when forwarding a pkt with no in6 dev
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Fri, 8 Apr 2022 14:03:42 +0000 (16:03 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 10:01:02 +0000 (12:01 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969857
commit e3fa461d8b0e185b7da8a101fe94dfe6dd500ac0 upstream.

kongweibin reported a kernel panic in ip6_forward() when input interface
has no in6 dev associated.

The following tc commands were used to reproduce this panic:
tc qdisc del dev vxlan100 root
tc qdisc add dev vxlan100 root netem corrupt 5%

CC: stable@vger.kernel.org
Fixes: ccd27f05ae7b ("ipv6: fix 'disable_policy' for fwd packets")
Reported-by: kongweibin <kongweibin2@huawei.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/ipv6/ip6_output.c

index af4b08427a33761720a789b2f52142792f81d3b6..4317846d7c1c6a5cf35e02845e0adb688b796fe8 100644 (file)
@@ -488,7 +488,7 @@ int ip6_forward(struct sk_buff *skb)
                goto drop;
 
        if (!net->ipv6.devconf_all->disable_policy &&
-           !idev->cnf.disable_policy &&
+           (!idev || !idev->cnf.disable_policy) &&
            !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
                __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
                goto drop;