fib_trie: call fib_table_flush_external under RTNL
authorSabrina Dubroca <sd@queasysnail.net>
Tue, 10 Mar 2015 20:03:54 +0000 (21:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Mar 2015 20:46:26 +0000 (16:46 -0400)
Move rtnl_lock() before the call to fib4_rules_exit so that
fib_table_flush_external is called under RTNL.

Fixes: 104616e74e0b ("switchdev: don't support custom ip rules, for now")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_frontend.c

index 7cda3b0521d8366489de3cfb5027a13d44bfbd57..a0b69ae8be1c30eb5a330a4e5928f1a8fe789fa5 100644 (file)
@@ -1171,11 +1171,12 @@ static void ip_fib_net_exit(struct net *net)
 {
        unsigned int i;
 
+       rtnl_lock();
+
 #ifdef CONFIG_IP_MULTIPLE_TABLES
        fib4_rules_exit(net);
 #endif
 
-       rtnl_lock();
        for (i = 0; i < FIB_TABLE_HASHSZ; i++) {
                struct hlist_head *head = &net->ipv4.fib_table_hash[i];
                struct hlist_node *tmp;