aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2017-04-24 08:18:28 -0400
committerDavid S. Miller <davem@davemloft.net>2017-04-25 11:43:16 -0400
commitb7d6df57516f8e6a1c847b822ec2a62555455f88 (patch)
tree43d9faf0dde9e65a188eac09d951d937c423b3f6
parent72ec0bc64b9a5d8e0efcb717abfc757746b101b7 (diff)
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: 5f81bd2e5d80 ("ipv6: export a stub for IPv6 symbols used by vxlan") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Acked-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/af_inet6.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index a9a9553ee63d..e82e59f22dfc 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -933,8 +933,6 @@ static int __init inet6_init(void)
933 if (err) 933 if (err)
934 goto igmp_fail; 934 goto igmp_fail;
935 935
936 ipv6_stub = &ipv6_stub_impl;
937
938 err = ipv6_netfilter_init(); 936 err = ipv6_netfilter_init();
939 if (err) 937 if (err)
940 goto netfilter_fail; 938 goto netfilter_fail;
@@ -1010,6 +1008,10 @@ static int __init inet6_init(void)
1010 if (err) 1008 if (err)
1011 goto sysctl_fail; 1009 goto sysctl_fail;
1012#endif 1010#endif
1011
1012 /* ensure that ipv6 stubs are visible only after ipv6 is ready */
1013 wmb();
1014 ipv6_stub = &ipv6_stub_impl;
1013out: 1015out:
1014 return err; 1016 return err;
1015 1017