From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v2] dmaengine: qcom_hidma: Fix runtime PM leak in hidma_issue_task()
Date: Fri, 06 Nov 2026 08:52:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-201091@kernel.org> (raw)
In-Reply-To: <179395457228.2120679.13809646473624751961@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dmaengine: qcom_hidma: stranded descriptors and PM leak in
hidma_issue_task()
--
commit 5c9f6221932ae0db0413c36b36c0997430c109f5
Author: Wentao Liang <vulab@iscas.ac.cn>
dmaengine: qcom_hidma: Fix runtime PM leak in hidma_issue_task()
This commit replaces pm_runtime_get_sync() with pm_runtime_resume_and_get()
in hidma_issue_task() and returns early without calling hidma_ll_start()
when runtime resume fails.
> diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
> index 1349066b1544d..c49cf622e5fb5 100644
> --- a/drivers/dma/qcom/hidma.c
> +++ b/drivers/dma/qcom/hidma.c
> @@ -219,7 +219,8 @@ static void hidma_issue_task(struct tasklet_struct *t)
> {
> struct hidma_dev *dmadev = from_tasklet(dmadev, t, task);
>
> - pm_runtime_get_sync(dmadev->ddev.dev);
> + if (pm_runtime_resume_and_get(dmadev->ddev.dev) < 0)
> + return;
> hidma_ll_start(dmadev->lldev);
> }
[Severity: Medium]
Does returning early here leave queued descriptors stranded on
mchan->active and still leak the runtime PM reference taken in
hidma_issue_pending()?
Before scheduling dmadev->task, hidma_issue_pending() already queues the
descriptors into dmadev->lldev and increments the runtime PM usage count:
drivers/dma/qcom/hidma.c:hidma_issue_pending() {
spin_lock_irqsave(&mchan->lock, flags);
list_for_each_entry_safe(qdesc, next, &mchan->queued, node) {
hidma_ll_queue_request(dmadev->lldev, qdesc->tre_ch);
list_move_tail(&qdesc->node, &mchan->active);
}
...
/* PM will be released in hidma_callback function. */
status = pm_runtime_get(dmadev->ddev.dev);
if (status < 0)
tasklet_schedule(&dmadev->task);
else
hidma_ll_start(dmadev->lldev);
}
pm_runtime_get() increments dev->power.usage_count unconditionally, even
when it returns a negative error such as -EINPROGRESS or -EACCES.
When pm_runtime_resume_and_get() fails in hidma_issue_task(), it only drops
the second reference that it took itself, leaving the reference from
pm_runtime_get() elevated. Skipping hidma_ll_start() without aborting the
queued TREs also leaves those descriptors stuck on mchan->active and
lldev->pending_tre_list, so hidma_callback() never runs to complete the
transfers or call pm_runtime_put_autosuspend().
When pm_runtime_resume_and_get() succeeds, both hidma_issue_pending() and
hidma_issue_task() have incremented usage_count, while hidma_callback()
only drops one reference.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179395457228.2120679.13809646473624751961@iscas.ac.cn?part=1
next prev parent reply other threads:[~2026-11-06 8:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 8:42 [PATCH v2] dmaengine: qcom_hidma: Fix runtime PM leak in hidma_issue_task() Wentao Liang
2026-11-06 8:52 ` sashiko-bot [this message]
2026-11-06 17:05 ` Frank Li
2026-11-07 6:15 ` Wentao Liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-201091@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=vulab@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox