From dbb50165b512f6c9b7aae10af73ae5b6d811f4d0 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 10 Jan 2008 03:21:49 -0800 Subject: [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 Acked-by: Daniel Lezcano Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- net/ipv4/fib_rules.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'net/ipv4/fib_rules.c') diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index afe669dd1bd..0751734ecf4 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -311,8 +311,18 @@ static int __init fib_default_rules_init(void) return 0; } -void __init fib4_rules_init(void) +int __init fib4_rules_init() { - BUG_ON(fib_default_rules_init()); + int err; + fib_rules_register(&init_net, &fib4_rules_ops); + err = fib_default_rules_init(); + if (err < 0) + goto fail; + return 0; + +fail: + /* also cleans all rules already added */ + fib_rules_unregister(&init_net, &fib4_rules_ops); + return err; } -- cgit v1.2.3