Skip to content

Commit

Permalink
fib6: install fib6 ops in the last step
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
WANG Cong authored and David S. Miller committed Mar 29, 2015
1 parent 7145074 commit 85b9909
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/ipv6/fib6_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 85b9909

Please sign in to comment.