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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9e0351a7-6118-4c36-97aa-011da8882253@intel.com>
Date: Tue, 30 Jul 2024 11:34:53 +0200
From: Wojciech Drewek <wojciech.drewek@...el.com>
To: Tariq Toukan <tariqt@...dia.com>, "David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Eric
 Dumazet" <edumazet@...gle.com>
CC: <netdev@...r.kernel.org>, Saeed Mahameed <saeedm@...dia.com>, Gal Pressman
	<gal@...dia.com>, Leon Romanovsky <leonro@...dia.com>, Shay Drory
	<shayd@...dia.com>, Maher Sanalla <msanalla@...dia.com>
Subject: Re: [PATCH net 2/8] net/mlx5: Fix error handling in
 irq_pool_request_irq



On 30.07.2024 08:16, Tariq Toukan wrote:
> From: Shay Drory <shayd@...dia.com>
> 
> In case mlx5_irq_alloc fails, the previously allocated index remains
> in the XArray, which could lead to inconsistencies.
> 
> Fix it by adding error handling that erases the allocated index
> from the XArray if mlx5_irq_alloc returns an error.
> 
> Fixes: c36326d38d93 ("net/mlx5: Round-Robin EQs over IRQs")
> Signed-off-by: Shay Drory <shayd@...dia.com>
> Reviewed-by: Maher Sanalla <msanalla@...dia.com>
> Signed-off-by: Tariq Toukan <tariqt@...dia.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>

>  drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
> index f7b01b3f0cba..1477db7f5307 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
> @@ -48,6 +48,7 @@ static struct mlx5_irq *
>  irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_desc)
>  {
>  	struct irq_affinity_desc auto_desc = {};
> +	struct mlx5_irq *irq;
>  	u32 irq_index;
>  	int err;
>  
> @@ -64,9 +65,12 @@ irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_de
>  		else
>  			cpu_get(pool, cpumask_first(&af_desc->mask));
>  	}
> -	return mlx5_irq_alloc(pool, irq_index,
> -			      cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
> -			      NULL);
> +	irq = mlx5_irq_alloc(pool, irq_index,
> +			     cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
> +			     NULL);
> +	if (IS_ERR(irq))
> +		xa_erase(&pool->irqs, irq_index);
> +	return irq;
>  }
>  
>  /* Looking for the IRQ with the smallest refcount that fits req_mask.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ