Skip to content

Commit

Permalink
ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup
Browse files Browse the repository at this point in the history
This is the IPv4 part for commit 905a6f9
(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>
  • Loading branch information
congwang authored and davem330 committed Apr 3, 2015
1 parent 666b805 commit ed78530
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/ipv4/ipmr.c
Expand Up @@ -278,10 +278,12 @@ static void __net_exit ipmr_rules_exit(struct net *net)
{
struct mr_table *mrt, *next;

rtnl_lock();
list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) {
list_del(&mrt->list);
ipmr_free_table(mrt);
}
rtnl_unlock();
fib_rules_unregister(net->ipv4.mr_rules_ops);
}
#else
Expand All @@ -308,7 +310,10 @@ static int __net_init ipmr_rules_init(struct net *net)

static void __net_exit ipmr_rules_exit(struct net *net)
{
rtnl_lock();
ipmr_free_table(net->ipv4.mrt);
net->ipv4.mrt = NULL;
rtnl_unlock();
}
#endif

Expand Down

0 comments on commit ed78530

Please sign in to comment.