dmaengine: idxd: add missing percpu ref put on failure
authorDave Jiang <dave.jiang@intel.com>
Thu, 24 Jun 2021 19:08:21 +0000 (12:08 -0700)
committerVinod Koul <vkoul@kernel.org>
Wed, 14 Jul 2021 06:58:15 +0000 (12:28 +0530)
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>
drivers/dma/idxd/submit.c

index 19afb62..b0f1ddf 100644 (file)
@@ -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);