[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>
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index afe669d..0751734 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -311,8 +311,18 @@
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;
}