Skip to content

Commit a3e340c

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: fix resource leak on dmaengine driver disable
The wq resources needs to be released before the kernel type is reset by __drv_disable_wq(). With dma channels unregistered and wq quiesced, all the wq resources for dmaengine can be freed. There is no need to wait until wq is disabled. With the wq->type being reset to "unknown", the driver is skipping the freeing of the resources. Fixes: 0cda4f6 ("dmaengine: idxd: create dmaengine driver for wq 'device'") Reported-by: Jacob Pan <[email protected]> Tested-by: Jacob Pan <[email protected]> Signed-off-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/163517405099.3484556.12521975053711345244.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <[email protected]>
1 parent 2efe58c commit a3e340c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/dma/idxd/dma.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,9 @@ static void idxd_dmaengine_drv_remove(struct idxd_dev *idxd_dev)
329329
mutex_lock(&wq->wq_lock);
330330
idxd_wq_quiesce(wq);
331331
idxd_unregister_dma_channel(wq);
332+
idxd_wq_free_resources(wq);
332333
__drv_disable_wq(wq);
333334
percpu_ref_exit(&wq->wq_active);
334-
idxd_wq_free_resources(wq);
335-
wq->type = IDXD_WQT_NONE;
336335
mutex_unlock(&wq->wq_lock);
337336
}
338337

0 commit comments

Comments
 (0)