Skip to contentSkip to conversation

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

PATCH Applied Fernando Fernandez Mancera 3 participants 3 messages Mar 30 – Apr 1

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().

---
 drivers/net/vxlan/vxlan_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/vxlan/vxlan_core.c +1 -3
index b5fbd03418b6..b3b692c4b628 100644
@@ -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);
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Fernando Fernandez Mancera

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().

I believe the RCU read-side critical section could be reduced a bit, but it's not critical, so:

#2 lore raw
In reply to Fernando Fernandez Mancera
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 30 Mar 2026 14:10:33 +0200 you wrote:

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().

[...]

Here is the summary with links:
- [net-next] net: vxlan: check ipv6_mod_enabled() on neigh_reduce()

    https://git.kernel.org/netdev/net-next/c/58e416e28328

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html