netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net ipv6: Fix duplicate /proc/sys/net/ipv6/neigh directory entries.
@ 2011-03-21 21:20 Eric W. Biederman
  2011-03-22  1:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric W. Biederman @ 2011-03-21 21:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Andrew Morton, sunkan


When I was fixing issues with unregisgtering tables under /proc/sys/net/ipv6/neigh
by adding a mount point it appears I missed a critical ordering issue, in the
ipv6 initialization.  I had not realized that ipv6_sysctl_register is called
at the very end of the ipv6 initialization and in particular after we call
neigh_sysctl_register from ndisc_init.

"neigh" needs to be initialized in ipv6_static_sysctl_register which is
the first ipv6 table to initialized, and definitely before ndisc_init.
This removes the weirdness of duplicate tables while still providing a
"neigh" mount point which prevents races in sysctl unregistering.

This was initially reported at https://bugzilla.kernel.org/show_bug.cgi?id=31232
Reported-by: sunkan@zappa.cx
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 net/ipv6/sysctl_net_ipv6.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 7cb65ef..6dcf5e7 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -17,6 +17,16 @@
 
 static struct ctl_table empty[1];
 
+static ctl_table ipv6_static_skeleton[] = {
+	{
+		.procname	= "neigh",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= empty,
+	},
+	{ }
+};
+
 static ctl_table ipv6_table_template[] = {
 	{
 		.procname	= "route",
@@ -37,12 +47,6 @@ static ctl_table ipv6_table_template[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec
 	},
-	{
-		.procname	= "neigh",
-		.maxlen		= 0,
-		.mode		= 0555,
-		.child		= empty,
-	},
 	{ }
 };
 
@@ -160,7 +164,7 @@ static struct ctl_table_header *ip6_base;
 
 int ipv6_static_sysctl_register(void)
 {
-	ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty);
+	ip6_base = register_sysctl_paths(net_ipv6_ctl_path, ipv6_static_skeleton);
 	if (ip6_base == NULL)
 		return -ENOMEM;
 	return 0;
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net ipv6: Fix duplicate /proc/sys/net/ipv6/neigh directory entries.
  2011-03-21 21:20 [PATCH] net ipv6: Fix duplicate /proc/sys/net/ipv6/neigh directory entries Eric W. Biederman
@ 2011-03-22  1:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-03-22  1:23 UTC (permalink / raw)
  To: ebiederm; +Cc: netdev, akpm, sunkan

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Mon, 21 Mar 2011 14:20:18 -0700

> 
> When I was fixing issues with unregisgtering tables under /proc/sys/net/ipv6/neigh
> by adding a mount point it appears I missed a critical ordering issue, in the
> ipv6 initialization.  I had not realized that ipv6_sysctl_register is called
> at the very end of the ipv6 initialization and in particular after we call
> neigh_sysctl_register from ndisc_init.
> 
> "neigh" needs to be initialized in ipv6_static_sysctl_register which is
> the first ipv6 table to initialized, and definitely before ndisc_init.
> This removes the weirdness of duplicate tables while still providing a
> "neigh" mount point which prevents races in sysctl unregistering.
> 
> This was initially reported at https://bugzilla.kernel.org/show_bug.cgi?id=31232
> Reported-by: sunkan@zappa.cx
> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-22  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-21 21:20 [PATCH] net ipv6: Fix duplicate /proc/sys/net/ipv6/neigh directory entries Eric W. Biederman
2011-03-22  1:23 ` 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).