lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aHSocHfM6IRFHneZ@mev-dev.igk.intel.com>
Date: Mon, 14 Jul 2025 08:49:29 +0200
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Tariq Toukan <tariqt@...dia.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Saeed Mahameed <saeed@...nel.org>, Gal Pressman <gal@...dia.com>,
	Leon Romanovsky <leon@...nel.org>,
	Saeed Mahameed <saeedm@...dia.com>, Mark Bloch <mbloch@...dia.com>,
	netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
	linux-kernel@...r.kernel.org, Leon Romanovsky <leonro@...dia.com>
Subject: Re: [PATCH net-next 3/6] net/mlx5e: Properly access RCU protected
 qdisc_sleeping variable

On Mon, Jul 14, 2025 at 08:39:42AM +0300, Tariq Toukan wrote:
> From: Leon Romanovsky <leonro@...dia.com>
> 
> qdisc_sleeping variable is declared as "struct Qdisc __rcu" and
> as such needs proper annotation while accessing it.
> 
> Without rtnl_dereference(), the following error is generated by sparse:
> 
> drivers/net/ethernet/mellanox/mlx5/core/en/qos.c:377:40: warning:
>   incorrect type in initializer (different address spaces)
> drivers/net/ethernet/mellanox/mlx5/core/en/qos.c:377:40:    expected
>   struct Qdisc *qdisc
> drivers/net/ethernet/mellanox/mlx5/core/en/qos.c:377:40:    got struct
>   Qdisc [noderef] __rcu *qdisc_sleeping
> 
> Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> Signed-off-by: Tariq Toukan <tariqt@...dia.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en/qos.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
> index f0744a45db92..4e461cb03b83 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/qos.c
> @@ -374,7 +374,7 @@ void mlx5e_reactivate_qos_sq(struct mlx5e_priv *priv, u16 qid, struct netdev_que
>  void mlx5e_reset_qdisc(struct net_device *dev, u16 qid)
>  {
>  	struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, qid);
> -	struct Qdisc *qdisc = dev_queue->qdisc_sleeping;
> +	struct Qdisc *qdisc = rtnl_dereference(dev_queue->qdisc_sleeping);
>  
>  	if (!qdisc)
>  		return;

Good catch, other acesses to the qdisc_sleeping are fine.

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>

> -- 
> 2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ