* [PATCH net] ipv6: move stub initialization after ipv6 setup completion
@ 2017-04-24 12:18 Paolo Abeni
2017-04-24 17:02 ` Cong Wang
2017-04-25 15:43 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Paolo Abeni @ 2017-04-24 12:18 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang, Hannes Frederic Sowa
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>
---
net/ipv6/af_inet6.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index a9a9553..e82e59f 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -933,8 +933,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;
@@ -1010,6 +1008,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;
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] ipv6: move stub initialization after ipv6 setup completion
2017-04-24 12:18 [PATCH net] ipv6: move stub initialization after ipv6 setup completion Paolo Abeni
@ 2017-04-24 17:02 ` Cong Wang
2017-04-25 15:43 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2017-04-24 17:02 UTC (permalink / raw)
To: Paolo Abeni
Cc: Linux Kernel Network Developers, David S. Miller,
Hannes Frederic Sowa
On Mon, Apr 24, 2017 at 5:18 AM, Paolo Abeni <pabeni@redhat.com> wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] ipv6: move stub initialization after ipv6 setup completion
2017-04-24 12:18 [PATCH net] ipv6: move stub initialization after ipv6 setup completion Paolo Abeni
2017-04-24 17:02 ` Cong Wang
@ 2017-04-25 15:43 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-04-25 15:43 UTC (permalink / raw)
To: pabeni; +Cc: netdev, xiyou.wangcong, hannes
From: Paolo Abeni <pabeni@redhat.com>
Date: Mon, 24 Apr 2017 14:18:28 +0200
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-25 15:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24 12:18 [PATCH net] ipv6: move stub initialization after ipv6 setup completion Paolo Abeni
2017-04-24 17:02 ` Cong Wang
2017-04-25 15:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).