The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net-next] caif: annotate phyinfo lookup under config lock
@ 2026-06-26  4:24 Runyu Xiao
  2026-06-27  1:07 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-06-26  4:24 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni
  Cc: horms, netdev, linux-kernel, runyu.xiao, jianhao.xu

cfcnfg_get_phyinfo_rcu() is used by both RCU read-side paths and config
update paths that hold cnfg->lock before adding or deleting entries from
cnfg->phys. The helper walks the list with list_for_each_entry_rcu(),
but does not tell lockdep about the config-lock-protected callers.

Pass lockdep_is_held(&cnfg->lock) to the iterator. RCU-reader callers
remain valid, and CONFIG_PROVE_RCU_LIST can now see the non-RCU
protection used by the add/delete paths.

This was found by our static analysis tool and then manually reviewed
against the current tree. The dynamic triage evidence is a
target-matched CONFIG_PROVE_RCU_LIST warning; the change is limited
to documenting the existing protection contract.

This is a lockdep annotation cleanup. It does not change CAIF phyinfo
list lifetime or update ordering.

Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 net/caif/cfcnfg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
index 52509e185960..6966cc9ab640 100644
--- a/net/caif/cfcnfg.c
+++ b/net/caif/cfcnfg.c
@@ -135,7 +135,8 @@ static struct cfcnfg_phyinfo *cfcnfg_get_phyinfo_rcu(struct cfcnfg *cnfg,
 {
 	struct cfcnfg_phyinfo *phy;
 
-	list_for_each_entry_rcu(phy, &cnfg->phys, node)
+	list_for_each_entry_rcu(phy, &cnfg->phys, node,
+				lockdep_is_held(&cnfg->lock))
 		if (phy->id == phyid)
 			return phy;
 	return NULL;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-27  1:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26  4:24 [PATCH net-next] caif: annotate phyinfo lookup under config lock Runyu Xiao
2026-06-27  1:07 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox