dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: add missing percpu ref put on failure
@ 2021-06-24 19:08 Dave Jiang
  2021-07-14  6:58 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2021-06-24 19:08 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine

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>
---
 drivers/dma/idxd/submit.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c
index 19afb62abaff..b0f1ddf75d31 100644
--- a/drivers/dma/idxd/submit.c
+++ b/drivers/dma/idxd/submit.c
@@ -118,8 +118,10 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
 		 * device is not accepting descriptor at all.
 		 */
 		rc = enqcmds(portal, desc->hw);
-		if (rc < 0)
+		if (rc < 0) {
+			percpu_ref_put(&wq->wq_active);
 			return rc;
+		}
 	}
 
 	percpu_ref_put(&wq->wq_active);



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: idxd: add missing percpu ref put on failure
  2021-06-24 19:08 [PATCH] dmaengine: idxd: add missing percpu ref put on failure Dave Jiang
@ 2021-07-14  6:58 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2021-07-14  6:58 UTC (permalink / raw)
  To: Dave Jiang; +Cc: dmaengine

On 24-06-21, 12:08, Dave Jiang wrote:
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-14  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 19:08 [PATCH] dmaengine: idxd: add missing percpu ref put on failure Dave Jiang
2021-07-14  6:58 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).