The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net-next] net: rmnet: annotate endpoint lookup under RTNL
@ 2026-07-01 12:40 Runyu Xiao
  2026-07-06  6:31 ` subash.a.kasiviswanathan
  0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-07-01 12:40 UTC (permalink / raw)
  To: subash.a.kasiviswanathan, sean.tranchetti
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, runyu.xiao, jianhao.xu

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.

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

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index ba8763cac9d9..977fb80d8bf8 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -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;
 	}
-- 
2.34.1


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

* RE: [PATCH net-next] net: rmnet: annotate endpoint lookup under RTNL
  2026-07-01 12:40 [PATCH net-next] net: rmnet: annotate endpoint lookup under RTNL Runyu Xiao
@ 2026-07-06  6:31 ` subash.a.kasiviswanathan
  0 siblings, 0 replies; 2+ messages in thread
From: subash.a.kasiviswanathan @ 2026-07-06  6:31 UTC (permalink / raw)
  To: 'Runyu Xiao', sean.tranchetti
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, jianhao.xu

> -----Original Message-----
> From: Runyu Xiao <runyu.xiao@seu.edu.cn>
> Sent: Wednesday, July 1, 2026 6:40 AM
> To: subash.a.kasiviswanathan@oss.qualcomm.com;
> sean.tranchetti@oss.qualcomm.com
> Cc: andrew+netdev@lunn.ch; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> runyu.xiao@seu.edu.cn; jianhao.xu@seu.edu.cn
> 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().
> 
> 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.
> 
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
>  drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> index ba8763cac9d9..977fb80d8bf8 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> @@ -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;
>  	}
> --
> 2.34.1

Reviewed-by: Subash Abhinov Kasiviswanathan
<subash.a.kasiviswanathan@oss.qualcomm.com>


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 12:40 [PATCH net-next] net: rmnet: annotate endpoint lookup under RTNL Runyu Xiao
2026-07-06  6:31 ` subash.a.kasiviswanathan

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