Skip to content

Commit d9cfb51

Browse files
vcgomesvinodkoul
authored andcommitted
dmaengine: idxd: Fix memory leak when a wq is reset
idxd_wq_disable_cleanup() which is called from the reset path for a workqueue, sets the wq type to NONE, which for other parts of the driver mean that the wq is empty (all its resources were released). Only set the wq type to NONE after its resources are released. Fixes: da32b28 ("dmaengine: idxd: cleanup workqueue config after disabling") Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Link: https://patch.msgid.link/20260121-idxd-fix-flr-on-kernel-queues-v3-v3-8-7ed70658a9d1@intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 3d33de3 commit d9cfb51

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/dma/idxd/device.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ void idxd_wq_free_resources(struct idxd_wq *wq)
175175
free_descs(wq);
176176
dma_free_coherent(dev, wq->compls_size, wq->compls, wq->compls_addr);
177177
sbitmap_queue_free(&wq->sbq);
178+
wq->type = IDXD_WQT_NONE;
178179
}
179180
EXPORT_SYMBOL_NS_GPL(idxd_wq_free_resources, "IDXD");
180181

@@ -382,7 +383,6 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
382383
lockdep_assert_held(&wq->wq_lock);
383384
wq->state = IDXD_WQ_DISABLED;
384385
memset(wq->wqcfg, 0, idxd->wqcfg_size);
385-
wq->type = IDXD_WQT_NONE;
386386
wq->threshold = 0;
387387
wq->priority = 0;
388388
wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES;
@@ -1558,7 +1558,6 @@ void idxd_drv_disable_wq(struct idxd_wq *wq)
15581558
idxd_wq_reset(wq);
15591559
idxd_wq_free_resources(wq);
15601560
percpu_ref_exit(&wq->wq_active);
1561-
wq->type = IDXD_WQT_NONE;
15621561
wq->client_count = 0;
15631562
}
15641563
EXPORT_SYMBOL_NS_GPL(idxd_drv_disable_wq, "IDXD");

0 commit comments

Comments
 (0)