Blob Blame History Raw
From ac24a2dc06cd773895d2fba0378c2538b8176565 Mon Sep 17 00:00:00 2001
From: Dave Jiang <dave.jiang@intel.com>
Date: Thu, 24 Jun 2021 12:08:21 -0700
Subject: [PATCH] dmaengine: idxd: add missing percpu ref put on failure
Git-commit: ac24a2dc06cd773895d2fba0378c2538b8176565
Patch-mainline: v5.15-rc1
References: git-fixes

When enqcmds() fails, exit path is missing a percpu_ref_put(). This can
cause failure on shutdown path when the driver is attempting to quiesce the
wq. Add missing percpu_ref_put() call on the error exit path.

Fixes: 93a40a6d7428 ("dmaengine: idxd: add percpu_ref to descriptor submission path")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/162456170168.1121236.7240941044089212312.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/dma/idxd/submit.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/dma/idxd/submit.c
+++ b/drivers/dma/idxd/submit.c
@@ -183,6 +183,7 @@ int idxd_submit_desc(struct idxd_wq *wq,
 		 */
 		rc = enqcmds(portal, desc->hw);
 		if (rc < 0) {
+			percpu_ref_put(&wq->wq_active);
 			if (ie)
 				llist_abort_desc(wq, ie, desc);
 			return rc;