ipv6: don't free static mem in the case of init_net
Subsystems (3)
PATCH 1/1 ipv6: don't free static mem in the case of init_net
Signed-off-by Hong Zhiguo <[email protected]>
--- net/ipv6/addrconf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/ipv6/addrconf.c +6 -2
@@ -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; }
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: Hong Zhiguo <[email protected]>
Date: Tue, 26 Mar 2013 00:25:25 +0800
Quoted 1 line
Signed-off-by Hong Zhiguo <[email protected]>
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, ...);