Commit dce5cbee authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller
Browse files

[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: default avatarDenis V. Lunev <>
Signed-off-by: default avatarDavid S. Miller <>
parent 3ed5df44
......@@ -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++)
return fib4_rules_init(net);
err = fib4_rules_init(net);
if (err < 0)
goto fail;
return 0;
return err;
static void __net_exit ip_fib_net_exit(struct net *net)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment