netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 1/1] ipv6: Remove unnecessary test
@ 2014-11-26  2:25 Zhu Yanjun
  2014-11-26 17:27 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Yanjun @ 2014-11-26  2:25 UTC (permalink / raw)
  To: zyjzyj2000, netdev, davem
  Cc: Zhu Yanjun, Hong Zhiguo, Octavian Purdila, Pavel Emelyanov,
	Cong Wang

The "init_net" test in function addrconf_exit_net is introduced
in commit 44a6bd29 [Create ipv6 devconf-s for namespaces] to avoid freeing
init_net. In commit c900a800 [ipv6: fix bad free of addrconf_init_net],
function addrconf_init_net will allocate memory for every net regardless of
init_net. In this case, it is unnecessary to make "init_net" test.

CC: Hong Zhiguo <honkiko@gmail.com>
CC: Octavian Purdila <opurdila@ixiacom.com>
CC: Pavel Emelyanov <xemul@openvz.org>
CC: Cong Wang <cwang@twopensource.com>
Suggested-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>

---
 net/ipv6/addrconf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0169ccf..b8724fc 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5336,10 +5336,8 @@ static void __net_exit addrconf_exit_net(struct net *net)
 	__addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
 	__addrconf_sysctl_unregister(net->ipv6.devconf_all);
 #endif
-	if (!net_eq(net, &init_net)) {
-		kfree(net->ipv6.devconf_dflt);
-		kfree(net->ipv6.devconf_all);
-	}
+	kfree(net->ipv6.devconf_dflt);
+	kfree(net->ipv6.devconf_all);
 }
 
 static struct pernet_operations addrconf_ops = {
-- 
1.9.1

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

* Re: [PATCH V3 1/1] ipv6: Remove unnecessary test
  2014-11-26  2:25 [PATCH V3 1/1] ipv6: Remove unnecessary test Zhu Yanjun
@ 2014-11-26 17:27 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-11-26 17:27 UTC (permalink / raw)
  To: zyjzyj2000; +Cc: netdev, Yanjun.Zhu, honkiko, opurdila, xemul, cwang

From: Zhu Yanjun <zyjzyj2000@gmail.com>
Date: Wed, 26 Nov 2014 10:25:58 +0800

> The "init_net" test in function addrconf_exit_net is introduced
> in commit 44a6bd29 [Create ipv6 devconf-s for namespaces] to avoid freeing
> init_net. In commit c900a800 [ipv6: fix bad free of addrconf_init_net],
> function addrconf_init_net will allocate memory for every net regardless of
> init_net. In this case, it is unnecessary to make "init_net" test.
> 
> CC: Hong Zhiguo <honkiko@gmail.com>
> CC: Octavian Purdila <opurdila@ixiacom.com>
> CC: Pavel Emelyanov <xemul@openvz.org>
> CC: Cong Wang <cwang@twopensource.com>
> Suggested-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>

Applied, thanks.

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

end of thread, other threads:[~2014-11-26 17:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-26  2:25 [PATCH V3 1/1] ipv6: Remove unnecessary test Zhu Yanjun
2014-11-26 17:27 ` 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).