Re: [PATCH 2/2 net v2] net: vxlan: fix nd_tbl NULL dereference when IPv6 is disabled

Fernando Fernandez Mancera
2026-03-02T15:13:17Z

On 3/2/26 3:43 PM, Sabrina Dubroca wrote:
> 2026-03-02, 15:08:47 +0100, Fernando Fernandez Mancera wrote:
>> When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never
>> initialized because inet6_init() exits before ndisc_init() is called
>> which initializes it. If an IPv6 packet is injected into the interface,
>> route_shortcircuit() is called and a NULL pointer dereference happens on
>> neigh_lookup().
>
> VXLAN can be built-in even when IPv6 is built as a module, and then
> ipv6_mod_enabled can't be used in VXLAN:
>
> ld: drivers/net/vxlan/vxlan_core.o: in function `route_shortcircuit':
> drivers/net/vxlan/vxlan_core.c:2133:(.text+0x116e0): undefined reference to `ipv6_mod_enabled'
>
>
> GENEVE has a Kconfig tweak to prevent this since 094be0927ff3
> ("geneve: fix build with modular IPV6"):
>
> depends on IPV6 || !IPV6
>
> but VXLAN doesn't.
>

Ugh, good catch. Thanks Sabrina.

> But then I think we don't need to use ipv6_stub at all.

If we enforce "depends on IPV6 || IPV6=n" on VXLAN we could get rid of
ipv6_stub completely and use direct calls instead.

Would you agree to do as Ido mentioned on v1 and follow neigh_reduce()
approach (__in6_dev_get()), then on net-next follow-up getting rid of
ipv6_stub? I think this could be good.

Thanks,
Fernando.