Re: [PATCH v2 09/10] dmaengine: idxd: free the queue interrupt when the percpu_ref setup fails

From: Frank Li

Date: Thu Dec 03 2026 - 12:44:34 EST


On Mon, Nov 30, 2026 at 11:47:20AM -0800, Daniel Byrne wrote:
> When idxd_wq_init_percpu_ref() fails, idxd_drv_enable_wq() unwinds
> through idxd_wq_free_resources() and then idxd_wq_free_irq(). Since
> commit d9cfb5193a04 ("dmaengine: idxd: Fix memory leak when a wq is
> reset") the first clears the queue's type, and the second returns at
> once for a queue whose type is not kernel. The interrupt stays
> requested with the queue's interrupt entry as its cookie, and on a
> device that uses interrupt handles the handle is not released. The next
> enable of the queue fails to request the vector.
>
> Free the interrupt first on that path.
>
> Fixes: d9cfb5193a04 ("dmaengine: idxd: Fix memory leak when a wq is reset")
> Cc: stable@xxxxxxxxxxxxxxx # 7.0+
> Signed-off-by: Daniel Byrne <daniel1.byrne@xxxxxxxxx>
> ---
> New in v2.
>
> drivers/dma/idxd/device.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index d1a8ccc14bb4..c4959a653330 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -1531,7 +1531,13 @@ int idxd_drv_enable_wq(struct idxd_wq *wq)
> return 0;
>
> err_ref:
> + /*
> + * idxd_wq_free_irq() goes first: it returns at once for a queue
> + * whose type idxd_wq_free_resources() has cleared.
> + */
> + idxd_wq_free_irq(wq);
> idxd_wq_free_resources(wq);
> + goto err_irq;

why need go to here. avoid goto again at error path.

Frank

> err_res_alloc:
> idxd_wq_free_irq(wq);
> err_irq:
> --
> 2.43.0
>