]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: vxlan: check ipv6_mod_enabled() on neigh_reduce()
authorFernando Fernandez Mancera <fmancera@suse.de>
Mon, 30 Mar 2026 12:10:33 +0000 (14:10 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Apr 2026 03:10:48 +0000 (20:10 -0700)
IPv6 must be enabled or otherwise neigh_reduce() might cause a kernel
panic. This was prevented by a check on in6_dev. Use ipv6_mod_enabled()
instead as it is cleaner and also consistent with the code at
route_shortcircuit().

Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260330121033.4479-1-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/vxlan/vxlan_core.c

index b5fbd03418b6744c0ce50b99d8f878f2b77339be..b3b692c4b62811ea139474ecd0d5330970b17e4b 100644 (file)
@@ -2027,13 +2027,11 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
        struct vxlan_dev *vxlan = netdev_priv(dev);
        const struct in6_addr *daddr;
        const struct ipv6hdr *iphdr;
-       struct inet6_dev *in6_dev;
        struct neighbour *n;
        struct nd_msg *msg;
 
        rcu_read_lock();
-       in6_dev = __in6_dev_get(dev);
-       if (!in6_dev)
+       if (unlikely(!ipv6_mod_enabled()))
                goto out;
 
        iphdr = ipv6_hdr(skb);