diff options
| author | WANG Cong <xiyou.wangcong@gmail.com> | 2015-03-31 14:01:45 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-04-02 20:52:34 -0400 |
| commit | ed785309c94445dd90e242370e1f7bb034e008fd (patch) | |
| tree | d00f8ddb893ba83f8a9138e5dc7ab335525e866d | |
| parent | 666b805150efd62f05810ff0db08f44a2370c937 (diff) | |
ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup
This is the IPv4 part for commit 905a6f96a1b1
(ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup).
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/ipv4/ipmr.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 92825443fad6..bc40115bc394 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
| @@ -278,10 +278,12 @@ static void __net_exit ipmr_rules_exit(struct net *net) | |||
| 278 | { | 278 | { |
| 279 | struct mr_table *mrt, *next; | 279 | struct mr_table *mrt, *next; |
| 280 | 280 | ||
| 281 | rtnl_lock(); | ||
| 281 | list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) { | 282 | list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) { |
| 282 | list_del(&mrt->list); | 283 | list_del(&mrt->list); |
| 283 | ipmr_free_table(mrt); | 284 | ipmr_free_table(mrt); |
| 284 | } | 285 | } |
| 286 | rtnl_unlock(); | ||
| 285 | fib_rules_unregister(net->ipv4.mr_rules_ops); | 287 | fib_rules_unregister(net->ipv4.mr_rules_ops); |
| 286 | } | 288 | } |
| 287 | #else | 289 | #else |
| @@ -308,7 +310,10 @@ static int __net_init ipmr_rules_init(struct net *net) | |||
| 308 | 310 | ||
| 309 | static void __net_exit ipmr_rules_exit(struct net *net) | 311 | static void __net_exit ipmr_rules_exit(struct net *net) |
| 310 | { | 312 | { |
| 313 | rtnl_lock(); | ||
| 311 | ipmr_free_table(net->ipv4.mrt); | 314 | ipmr_free_table(net->ipv4.mrt); |
| 315 | net->ipv4.mrt = NULL; | ||
| 316 | rtnl_unlock(); | ||
| 312 | } | 317 | } |
| 313 | #endif | 318 | #endif |
| 314 | 319 | ||
