Skip to content

Commit 0c3d3ac

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 fc34f19 commit 0c3d3ac

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;
@@ -1531,7 +1531,6 @@ void idxd_drv_disable_wq(struct idxd_wq *wq)
15311531
idxd_wq_reset(wq);
15321532
idxd_wq_free_resources(wq);
15331533
percpu_ref_exit(&wq->wq_active);
1534-
wq->type = IDXD_WQT_NONE;
15351534
wq->client_count = 0;
15361535
}
15371536
EXPORT_SYMBOL_NS_GPL(idxd_drv_disable_wq, "IDXD");

0 commit comments

Comments
 (0)