summaryrefslogtreecommitdiffstats
path: root/net/ipv6/fib6_rules.c
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2015-03-25 14:45:02 -0700
committerDavid S. Miller <davem@davemloft.net>2015-03-29 12:12:37 -0700
commit85b9909272f128757dcb6d053ca12e15931747d4 (patch)
tree13f6be2a38fc787a3fa3137bc32c2c5ef023936c /net/ipv6/fib6_rules.c
parent7145074b374dd90a4512fe52c062b336b724f276 (diff)
downloadlinux-85b9909272f128757dcb6d053ca12e15931747d4.tar.gz
linux-85b9909272f128757dcb6d053ca12e15931747d4.tar.bz2
linux-85b9909272f128757dcb6d053ca12e15931747d4.zip
fib6: install fib6 ops in the last step
We should not commit the new ops until we finish all the setup, otherwise we have to NULL it on failure. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r--net/ipv6/fib6_rules.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 27ca79682efb..273eb26cd6d4 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -299,19 +299,16 @@ static int __net_init fib6_rules_net_init(struct net *net)
ops = fib_rules_register(&fib6_rules_ops_template, net);
if (IS_ERR(ops))
return PTR_ERR(ops);
- net->ipv6.fib6_rules_ops = ops;
-
- err = fib_default_rule_add(net->ipv6.fib6_rules_ops, 0,
- RT6_TABLE_LOCAL, 0);
+ err = fib_default_rule_add(ops, 0, RT6_TABLE_LOCAL, 0);
if (err)
goto out_fib6_rules_ops;
- err = fib_default_rule_add(net->ipv6.fib6_rules_ops,
- 0x7FFE, RT6_TABLE_MAIN, 0);
+ err = fib_default_rule_add(ops, 0x7FFE, RT6_TABLE_MAIN, 0);
if (err)
goto out_fib6_rules_ops;
+ net->ipv6.fib6_rules_ops = ops;
out:
return err;