Skip to content

Commit 2f73732

Browse files
shayshyiNipaLocal
authored andcommitted
net/mlx5: Fix error handling in irq_pool_request_irq
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: c36326d ("net/mlx5: Round-Robin EQs over IRQs") Signed-off-by: Shay Drory <[email protected]> Reviewed-by: Maher Sanalla <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent b6b49d2 commit 2f73732

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static struct mlx5_irq *
4848
irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_desc)
4949
{
5050
struct irq_affinity_desc auto_desc = {};
51+
struct mlx5_irq *irq;
5152
u32 irq_index;
5253
int err;
5354

@@ -64,9 +65,12 @@ irq_pool_request_irq(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_de
6465
else
6566
cpu_get(pool, cpumask_first(&af_desc->mask));
6667
}
67-
return mlx5_irq_alloc(pool, irq_index,
68-
cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
69-
NULL);
68+
irq = mlx5_irq_alloc(pool, irq_index,
69+
cpumask_empty(&auto_desc.mask) ? af_desc : &auto_desc,
70+
NULL);
71+
if (IS_ERR(irq))
72+
xa_erase(&pool->irqs, irq_index);
73+
return irq;
7074
}
7175

7276
/* Looking for the IRQ with the smallest refcount that fits req_mask.

0 commit comments

Comments
 (0)