Skip to content

Commit b7d6df5

Browse files
Paolo Abenidavem330
authored andcommitted
ipv6: move stub initialization after ipv6 setup completion
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: 5f81bd2 ("ipv6: export a stub for IPv6 symbols used by vxlan") Signed-off-by: Paolo Abeni <[email protected]> Acked-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 72ec0bc commit b7d6df5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/ipv6/af_inet6.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,8 +933,6 @@ static int __init inet6_init(void)
933933
if (err)
934934
goto igmp_fail;
935935

936-
ipv6_stub = &ipv6_stub_impl;
937-
938936
err = ipv6_netfilter_init();
939937
if (err)
940938
goto netfilter_fail;
@@ -1010,6 +1008,10 @@ static int __init inet6_init(void)
10101008
if (err)
10111009
goto sysctl_fail;
10121010
#endif
1011+
1012+
/* ensure that ipv6 stubs are visible only after ipv6 is ready */
1013+
wmb();
1014+
ipv6_stub = &ipv6_stub_impl;
10131015
out:
10141016
return err;
10151017

0 commit comments

Comments
 (0)