net: hsr: Pass lockdep expression to RCU lists
authorAmol Grover <frextrite@gmail.com>
Wed, 19 Feb 2020 10:00:11 +0000 (15:30 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Feb 2020 18:55:42 +0000 (10:55 -0800)
node_db is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of hsr->list_lock.

Hence, add corresponding lockdep expression to silence false-positive
warnings, and harden RCU lists.

Signed-off-by: Amol Grover <frextrite@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/hsr/hsr_framereg.c

index 364ea2cc028e9a0ccb1a9d409961943cae8e1b3f..3ba7f61be10784a6bb5c814dfe669c320edbc8dd 100644 (file)
@@ -155,7 +155,8 @@ static struct hsr_node *hsr_add_node(struct hsr_priv *hsr,
                new_node->seq_out[i] = seq_out;
 
        spin_lock_bh(&hsr->list_lock);
-       list_for_each_entry_rcu(node, node_db, mac_list) {
+       list_for_each_entry_rcu(node, node_db, mac_list,
+                               lockdep_is_held(&hsr->list_lock)) {
                if (ether_addr_equal(node->macaddress_A, addr))
                        goto out;
                if (ether_addr_equal(node->macaddress_B, addr))