summaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-10 03:21:49 -0800
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:01:25 -0800
commitdbb50165b512f6c9b7aae10af73ae5b6d811f4d0 (patch)
tree9ba74fb468ec461668351a64c76c5f5d469842fa /net/ipv4/fib_frontend.c
parent61a0265344786a548e8a0b26cb668e78a71f9602 (diff)
downloadop-kernel-dev-dbb50165b512f6c9b7aae10af73ae5b6d811f4d0.zip
op-kernel-dev-dbb50165b512f6c9b7aae10af73ae5b6d811f4d0.tar.gz
[IPV4]: Check fib4_rules_init failure.
This adds error paths into both versions of fib4_rules_init (with/without CONFIG_IP_MULTIPLE_TABLES) and returns error code to the caller. Acked-by: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> 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.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index ac6238a..1bb956b 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -59,12 +59,24 @@ struct fib_table *ip_fib_main_table;
#define FIB_TABLE_HASHSZ 1
static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ];
-static void __init fib4_rules_init(void)
+static int __init fib4_rules_init(void)
{
ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL);
- hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]);
+ if (ip_fib_local_table == NULL)
+ return -ENOMEM;
+
ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN);
+ if (ip_fib_main_table == NULL)
+ goto fail;
+
+ hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]);
hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]);
+ return 0;
+
+fail:
+ kfree(ip_fib_local_table);
+ ip_fib_local_table = NULL;
+ return -ENOMEM;
}
#else
@@ -944,7 +956,7 @@ void __init ip_fib_init(void)
for (i = 0; i < FIB_TABLE_HASHSZ; i++)
INIT_HLIST_HEAD(&fib_table_hash[i]);
- fib4_rules_init();
+ BUG_ON(fib4_rules_init());
register_netdevice_notifier(&fib_netdev_notifier);
register_inetaddr_notifier(&fib_inetaddr_notifier);
OpenPOWER on IntegriCloud