Commit eacf8070 authored by Paolo Abeni's avatar Paolo Abeni Committed by Ben Hutchings

ipv6: move stub initialization after ipv6 setup completion

commit b7d6df57 upstream.

The ipv6 stub pointer is currently initialized before the ipv6
routing subsystem: a 3rd party can access and use such stub
before the routing data is ready.
Moreover, such pointer is not cleared in case of initialization
error, possibly leading to dangling pointers usage.

This change addresses the above moving the stub initialization
at the end of ipv6 init code.

Fixes: 5f81bd2e ("ipv6: export a stub for IPv6 symbols used by vxlan")
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 0b333ba5
......@@ -899,8 +899,6 @@ static int __init inet6_init(void)
if (err)
goto igmp_fail;
ipv6_stub = &ipv6_stub_impl;
err = ipv6_netfilter_init();
if (err)
goto netfilter_fail;
......@@ -964,6 +962,10 @@ static int __init inet6_init(void)
if (err)
goto sysctl_fail;
#endif
/* ensure that ipv6 stubs are visible only after ipv6 is ready */
wmb();
ipv6_stub = &ipv6_stub_impl;
out:
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment