Skip to contentSkip to conversation

net: rmnet: annotate endpoint lookup under RTNL

PATCH Applied Runyu Xiao 3 participants 3 messages Jul 1 – Jul 8

Subsystems (3)
lore
Share & tools
lore

Runyu Xiao

author
#0 lore raw

PATCH 1/1 net: rmnet: annotate endpoint lookup under RTNL

rmnet_get_endpoint() is shared by packet receive paths and RTNL-protected control paths. The receive paths already run under RCU/BH context through the RX handler, while the control paths reach rmnet_get_endpoint() after obtaining the rmnet port with rmnet_get_port_rtnl().

The helper walks port->muxed_ep[] with hlist_for_each_entry_rcu(). Pass lockdep_rtnl_is_held() as the non-RCU protection condition so CONFIG_PROVE_RCU_LIST can see the RTNL-protected control-path calls while preserving the existing RCU-reader behavior for data 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 endpoint lifetime or hash updates.

---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +2 -1
index ba8763cac9d9..977fb80d8bf8 100644
@@ -423,7 +423,8 @@ struct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id)
 {
 	struct rmnet_endpoint *ep;
 
-	hlist_for_each_entry_rcu(ep, &port->muxed_ep[mux_id], hlnode) {
+	hlist_for_each_entry_rcu(ep, &port->muxed_ep[mux_id], hlnode,
+				 lockdep_rtnl_is_held()) {
 		if (ep->mux_id == mux_id)
 			return ep;
 	}
Signature · 1 line
2.34.1
#1 lore raw
Quoted 17 lines

-----Original Message-----
From: Runyu Xiao <[email protected]>
Sent: Wednesday, July 1, 2026 6:40 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH net-next] net: rmnet: annotate endpoint lookup under RTNL

rmnet_get_endpoint() is shared by packet receive paths and RTNL-protected control paths. The receive paths already run under RCU/BH context through the RX handler, while the control paths reach rmnet_get_endpoint() after obtaining the rmnet port with rmnet_get_port_rtnl().

Quoted 6 lines

The helper walks port->muxed_ep[] with hlist_for_each_entry_rcu(). Pass lockdep_rtnl_is_held() as the non-RCU protection condition so CONFIG_PROVE_RCU_LIST can see the RTNL-protected control-path calls while preserving the existing RCU-reader behavior for data paths.

This was found by our static analysis tool and then manually reviewed

against

Quoted 5 lines

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 endpoint lifetime

or

Quoted 23 lines

hash updates.

---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +2 -2
index ba8763cac9d9..977fb80d8bf8 100644
@@ -423,7 +423,8 @@ struct rmnet_endpoint *rmnet_get_endpoint(struct
 rmnet_port *port, u8 mux_id)  {
 	struct rmnet_endpoint *ep;
 
-	hlist_for_each_entry_rcu(ep, &port->muxed_ep[mux_id], hlnode) {
+	hlist_for_each_entry_rcu(ep, &port->muxed_ep[mux_id], hlnode,
+				 lockdep_rtnl_is_held()) {
 		if (ep->mux_id == mux_id)
 			return ep;
 	}
--
Quoted 1 line

2.34.1

Reviewed-by: Subash Abhinov Kasiviswanathan
<[email protected]>

#2 lore raw
In reply to Runyu Xiao
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 6 lines · On Wed, 1 Jul 2026 20:40:17 +0800 you wrote:

rmnet_get_endpoint() is shared by packet receive paths and RTNL-protected control paths. The receive paths already run under RCU/BH context through the RX handler, while the control paths reach rmnet_get_endpoint() after obtaining the rmnet port with rmnet_get_port_rtnl().

Quoted 6 lines

The helper walks port->muxed_ep[] with hlist_for_each_entry_rcu(). Pass lockdep_rtnl_is_held() as the non-RCU protection condition so CONFIG_PROVE_RCU_LIST can see the RTNL-protected control-path calls while preserving the existing RCU-reader behavior for data paths.

[...]

Here is the summary with links:
- [net-next] net: rmnet: annotate endpoint lookup under RTNL

    https://git.kernel.org/netdev/net-next/c/4fa0619d039f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html