USB: gadgetfs: Fix race between mounting and unmounting
[platform/kernel/linux-starfive.git] / drivers / net / macvlan.c
index 8f8f730..b8cc55b 100644 (file)
@@ -141,7 +141,7 @@ static struct macvlan_source_entry *macvlan_hash_lookup_source(
        u32 idx = macvlan_eth_hash(addr);
        struct hlist_head *h = &vlan->port->vlan_source_hash[idx];
 
-       hlist_for_each_entry_rcu(entry, h, hlist) {
+       hlist_for_each_entry_rcu(entry, h, hlist, lockdep_rtnl_is_held()) {
                if (ether_addr_equal_64bits(entry->addr, addr) &&
                    entry->vlan == vlan)
                        return entry;
@@ -361,7 +361,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port,
        }
        spin_unlock(&port->bc_queue.lock);
 
-       schedule_work(&port->bc_work);
+       queue_work(system_unbound_wq, &port->bc_work);
 
        if (err)
                goto free_nskb;
@@ -1533,8 +1533,10 @@ destroy_macvlan_port:
        /* the macvlan port may be freed by macvlan_uninit when fail to register.
         * so we destroy the macvlan port only when it's valid.
         */
-       if (create && macvlan_port_get_rtnl(lowerdev))
+       if (create && macvlan_port_get_rtnl(lowerdev)) {
+               macvlan_flush_sources(port, vlan);
                macvlan_port_destroy(port->dev);
+       }
        return err;
 }
 EXPORT_SYMBOL_GPL(macvlan_common_newlink);
@@ -1645,7 +1647,7 @@ static int macvlan_fill_info_macaddr(struct sk_buff *skb,
        struct hlist_head *h = &vlan->port->vlan_source_hash[i];
        struct macvlan_source_entry *entry;
 
-       hlist_for_each_entry_rcu(entry, h, hlist) {
+       hlist_for_each_entry_rcu(entry, h, hlist, lockdep_rtnl_is_held()) {
                if (entry->vlan != vlan)
                        continue;
                if (nla_put(skb, IFLA_MACVLAN_MACADDR, ETH_ALEN, entry->addr))