net: vxlan: check ipv6_mod_enabled() on neigh_reduce()

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>
This commit is contained in:
Fernando Fernandez Mancera 2026-03-30 14:10:33 +02:00 committed by Jakub Kicinski
parent d7709812e1
commit 58e416e283

View 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);