net: vxlan: check ipv6_mod_enabled() on neigh_reduce()
Subsystems (2)
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
@@ -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
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 onin6_dev. Useipv6_mod_enabled()instead as it is cleaner and also consistent with the code atroute_shortcircuit().Signed-off-by Fernando Fernandez Mancera <[email protected]>
I believe the RCU read-side critical section could be reduced a bit, but it's not critical, so:
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 onin6_dev. Useipv6_mod_enabled()instead as it is cleaner and also consistent with the code atroute_shortcircuit().Signed-off-by Fernando Fernandez Mancera <[email protected]>[...]
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