Skip to content

Commit 39c1504

Browse files
vcgomesgregkh
authored andcommitted
dmaengine: idxd: Fix memory leak when a wq is reset
[ Upstream commit d9cfb51 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d02c24a commit 39c1504

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
@@ -174,6 +174,7 @@ void idxd_wq_free_resources(struct idxd_wq *wq)
174174
free_descs(wq);
175175
dma_free_coherent(dev, wq->compls_size, wq->compls, wq->compls_addr);
176176
sbitmap_queue_free(&wq->sbq);
177+
wq->type = IDXD_WQT_NONE;
177178
}
178179
EXPORT_SYMBOL_NS_GPL(idxd_wq_free_resources, IDXD);
179180

@@ -367,7 +368,6 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq)
367368
lockdep_assert_held(&wq->wq_lock);
368369
wq->state = IDXD_WQ_DISABLED;
369370
memset(wq->wqcfg, 0, idxd->wqcfg_size);
370-
wq->type = IDXD_WQT_NONE;
371371
wq->threshold = 0;
372372
wq->priority = 0;
373373
wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES;
@@ -1513,7 +1513,6 @@ void idxd_drv_disable_wq(struct idxd_wq *wq)
15131513
idxd_wq_reset(wq);
15141514
idxd_wq_free_resources(wq);
15151515
percpu_ref_exit(&wq->wq_active);
1516-
wq->type = IDXD_WQT_NONE;
15171516
wq->client_count = 0;
15181517
}
15191518
EXPORT_SYMBOL_NS_GPL(idxd_drv_disable_wq, IDXD);

0 commit comments

Comments
 (0)