• WANG Cong's avatar
    net: move fib_rules_unregister() under rtnl lock · 419df12f
    WANG Cong authored
    We have to hold rtnl lock for fib_rules_unregister()
    otherwise the following race could happen:
    
    fib_rules_unregister():	fib_nl_delrule():
    ...				...
    ...				ops = lookup_rules_ops();
    list_del_rcu(&ops->list);
    				list_for_each_entry(ops->rules) {
    fib_rules_cleanup_ops(ops);	  ...
      list_del_rcu();		  list_del_rcu();
    				}
    
    Note, net->rules_mod_lock is actually not needed at all,
    either upper layer netns code or rtnl lock guarantees
    we are safe.
    
    Cc: Alexander Duyck <alexander.h.duyck@redhat.com>
    Cc: Thomas Graf <tgraf@suug.ch>
    Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    419df12f
ip6mr.c 57.1 KB