Skip to contentSkip to conversation

net: netlabel: Use built-in RCU list checking

PATCH Applied [email protected] 3 participants 3 messages Feb 18, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: netlabel: Use built-in RCU list checking

From: Madhuparna Bhowmik <[email protected]>

list_for_each_entry_rcu() has built-in RCU and lock checking.

Pass cond argument to list_for_each_entry_rcu() to silence false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled by default.

---
 net/netlabel/netlabel_unlabeled.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netlabel/netlabel_unlabeled.c +2 -1
index d2e4ab8d1cb1..77bb1bb22c3b 100644
@@ -207,7 +207,8 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex)
 
 	bkt = netlbl_unlhsh_hash(ifindex);
 	bkt_list = &netlbl_unlhsh_rcu_deref(netlbl_unlhsh)->tbl[bkt];
-	list_for_each_entry_rcu(iter, bkt_list, list)
+	list_for_each_entry_rcu(iter, bkt_list, list,
+				lockdep_is_held(&netlbl_unlhsh_lock))
 		if (iter->valid && iter->ifindex == ifindex)
 			return iter;
 
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Tue, Feb 18, 2020 at 1:17 PM <[email protected]> wrote:

From: Madhuparna Bhowmik <[email protected]>

list_for_each_entry_rcu() has built-in RCU and lock checking.

Quoted 8 lines

Pass cond argument to list_for_each_entry_rcu() to silence false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled by default.

---
 net/netlabel/netlabel_unlabeled.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Not that this has much bearing since it's already been merged, but for what it's worth ...

Quoted 16 lines
net/netlabel/netlabel_unlabeled.c +2 -2
index d2e4ab8d1cb1..77bb1bb22c3b 100644
@@ -207,7 +207,8 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex)
 
        bkt = netlbl_unlhsh_hash(ifindex);
        bkt_list = &netlbl_unlhsh_rcu_deref(netlbl_unlhsh)->tbl[bkt];
-       list_for_each_entry_rcu(iter, bkt_list, list)
+       list_for_each_entry_rcu(iter, bkt_list, list,
+                               lockdep_is_held(&netlbl_unlhsh_lock))
                if (iter->valid && iter->ifindex == ifindex)
                        return iter;
 
--

2.17.1

Signature · 2 lines
paul moore
www.paul-moore.com