* [PATCH net-next] ipv6: don't free static mem in the case of init_net
@ 2013-03-25 16:25 Hong Zhiguo
2013-03-25 17:16 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Hong Zhiguo @ 2013-03-25 16:25 UTC (permalink / raw)
To: netdev; +Cc: davem, stephen, Hong Zhiguo
Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
---
net/ipv6/addrconf.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index fa36a67..1f5f51f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4891,10 +4891,14 @@ static int __net_init addrconf_init_net(struct net *net)
err_reg_dflt:
__addrconf_sysctl_unregister(all);
err_reg_all:
- kfree(dflt);
+ if (dflt != &ipv6_devconf_dflt) {
+ kfree(dflt);
+ }
#endif
err_alloc_dflt:
- kfree(all);
+ if (all != &ipv6_devconf) {
+ kfree(all);
+ }
err_alloc_all:
return err;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] ipv6: don't free static mem in the case of init_net
2013-03-25 16:25 [PATCH net-next] ipv6: don't free static mem in the case of init_net Hong Zhiguo
@ 2013-03-25 17:16 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-03-25 17:16 UTC (permalink / raw)
To: honkiko; +Cc: netdev, stephen
From: Hong Zhiguo <honkiko@gmail.com>
Date: Tue, 26 Mar 2013 00:25:25 +0800
> Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
1) This should be submitted against 'net' since it's clearly
a real bug.
2) This needs to be fixed differently. We should always
kmemdup() and create fresh copies of these objects, even
for init_net. So 'dflt' and 'all' will start as "NULL"
and always we will try to kmemdup(&ipv6_defconf, ...) and
kmemdup(&ipv6_devconf_dflt, ...);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-25 17:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 16:25 [PATCH net-next] ipv6: don't free static mem in the case of init_net Hong Zhiguo
2013-03-25 17:16 ` 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).