* [Patch net 1/2] fib6: install fib6 ops in the last step
@ 2015-03-25 21:45 Cong Wang
2015-03-25 21:45 ` [Patch net 2/2] ipmr,ip6mr: call ip6mr_free_table() on failure path Cong Wang
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Cong Wang @ 2015-03-25 21:45 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang
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(-)
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;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [Patch net 2/2] ipmr,ip6mr: call ip6mr_free_table() on failure path
2015-03-25 21:45 [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
@ 2015-03-25 21:45 ` Cong Wang
2015-03-29 19:14 ` David Miller
2015-03-26 3:49 ` [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
2015-03-29 19:14 ` David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2015-03-25 21:45 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/ipv4/ipmr.c | 2 +-
net/ipv6/ip6mr.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 68f67b8..fc12a09 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -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;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 3df1ec2..9916f6f 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -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;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Patch net 1/2] fib6: install fib6 ops in the last step
2015-03-25 21:45 [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
2015-03-25 21:45 ` [Patch net 2/2] ipmr,ip6mr: call ip6mr_free_table() on failure path Cong Wang
@ 2015-03-26 3:49 ` Cong Wang
2015-03-29 19:14 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2015-03-26 3:49 UTC (permalink / raw)
To: Linux Kernel Network Developers; +Cc: Cong Wang
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch net 1/2] fib6: install fib6 ops in the last step
2015-03-25 21:45 [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
2015-03-25 21:45 ` [Patch net 2/2] ipmr,ip6mr: call ip6mr_free_table() on failure path Cong Wang
2015-03-26 3:49 ` [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
@ 2015-03-29 19:14 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-03-29 19:14 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-29 19:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25 21:45 [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
2015-03-25 21:45 ` [Patch net 2/2] ipmr,ip6mr: call ip6mr_free_table() on failure path Cong Wang
2015-03-29 19:14 ` David Miller
2015-03-26 3:49 ` [Patch net 1/2] fib6: install fib6 ops in the last step Cong Wang
2015-03-29 19:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).