diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-31 18:44:53 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 19:28:37 -0800 |
commit | dce5cbeec32eb5db4d406b732b1256c6f702bde5 (patch) | |
tree | 38c9fe8ba24567d7914b949059a896f683aa6e29 /net/ipv4/fib_frontend.c | |
parent | 3ed5df445eddce6f37767df3ebe8b27b614c7d98 (diff) | |
download | talos-obmc-linux-dce5cbeec32eb5db4d406b732b1256c6f702bde5.tar.gz talos-obmc-linux-dce5cbeec32eb5db4d406b732b1256c6f702bde5.zip |
[IPV4]: Fix memory leak on error path during FIB initialization.
net->ipv4.fib_table_hash is not freed when fib4_rules_init failed.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r-- | net/ipv4/fib_frontend.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index d28261826bc2..d0507f4f848a 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -975,6 +975,7 @@ static struct notifier_block fib_netdev_notifier = { static int __net_init ip_fib_net_init(struct net *net) { + int err; unsigned int i; net->ipv4.fib_table_hash = kzalloc( @@ -985,7 +986,14 @@ static int __net_init ip_fib_net_init(struct net *net) for (i = 0; i < FIB_TABLE_HASHSZ; i++) INIT_HLIST_HEAD(&net->ipv4.fib_table_hash[i]); - return fib4_rules_init(net); + err = fib4_rules_init(net); + if (err < 0) + goto fail; + return 0; + +fail: + kfree(net->ipv4.fib_table_hash); + return err; } static void __net_exit ip_fib_net_exit(struct net *net) |