diff mbox

[net,1/2] fib6: install fib6 ops in the last step

Message ID 1427319903-22976-1-git-send-email-xiyou.wangcong@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Cong Wang March 25, 2015, 9:45 p.m. UTC
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>
---
 net/ipv6/fib6_rules.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Cong Wang March 26, 2015, 3:49 a.m. UTC | #1
On Wed, Mar 25, 2015 at 2:45 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> We should not commit the new ops until we finish
> all the setup, otherwise we have to NULL it on failure.
>

I messed up my net branch with net-next, so this single patch
actually doesn't fix any bug so can be just targeted for net-next.

Let me know if you want me to resend.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 29, 2015, 7:14 p.m. UTC | #2
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Wed, 25 Mar 2015 14:45:02 -0700

> 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>

Applied to net-next
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 27ca796..273eb26 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;