Skip to contentSkip to conversation

fib6: install fib6 ops in the last step

PATCH Applied Cong Wang 2 participants 5 messages Mar 25, 2015 – Mar 29, 2015

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/2 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.

---
 net/ipv6/fib6_rules.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
net/ipv6/fib6_rules.c +3 -6
index 27ca796..273eb26 100644
@@ -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;
 
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 2/2 ipmr,ip6mr: call ip6mr_free_table() on failure path

---
 net/ipv4/ipmr.c  | 2 +-
 net/ipv6/ip6mr.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ipmr.c +1 -1
index 68f67b8..fc12a09 100644
@@ -268,7 +268,7 @@ static int __net_init ipmr_rules_init(struct net *net)
 	return 0;
 
 err2:
-	kfree(mrt);
+	ipmr_free_table(mrt);
 err1:
 	fib_rules_unregister(ops);
 	return err;
net/ipv6/ip6mr.c +1 -1
index 3df1ec2..9916f6f 100644
@@ -252,7 +252,7 @@ static int __net_init ip6mr_rules_init(struct net *net)
 	return 0;
 
 err2:
-	kfree(mrt);
+	ip6mr_free_table(mrt);
 err1:
 	fib_rules_unregister(ops);
 	return err;
Signature · 1 line
1.8.3.1
author
#3 lore raw
In reply to Cong Wang
Quoted 3 lines · Cong Wang

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.