All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hungyu Lin" <dennylin0707@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v2] media: qcom: iris: fix runtime PM reference leaks
Date: Thu, 04 Jun 2026 04:02:14 +0000	[thread overview]
Message-ID: <20260604040214.ABC541F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604035133.39825-1-dennylin0707@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] In `iris_core_deinit()`, the return value of `pm_runtime_resume_and_get()` is ignored, leading to unprotected hardware accesses and an unbalanced PM usage counter if resume fails.
--

commit acf00d2e310620bc8e8cebd99a624ed3e592b957
Author: Hungyu Lin <dennylin0707@gmail.com>

media: qcom: iris: fix runtime PM reference leaks

Use pm_runtime_resume_and_get() in iris_enable_power_domains()
to avoid leaking a runtime PM usage count on failure.

Also ensure pm_runtime_put_sync() is always called in
iris_disable_power_domains(), even when iris_opp_set_rate()
fails, so runtime PM references remain balanced.

> diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
> index 773f6548370a2..f5e3341e14309 100644
> --- a/drivers/media/platform/qcom/iris/iris_resources.c
> +++ b/drivers/media/platform/qcom/iris/iris_resources.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential issue
in drivers/media/platform/qcom/iris/iris_core.c:

void iris_core_deinit(struct iris_core *core)
{
	pm_runtime_resume_and_get(core->dev);

	mutex_lock(&core->lock);
	...

Is it safe to ignore the return value of pm_runtime_resume_and_get() here?

If it fails, it returns a negative error code and does not increment the
device's PM usage counter.

Could this lead to unprotected hardware accesses when iris_vpu_power_off()
is called later in the function, potentially causing a synchronous external
abort?

Additionally, the PM usage counter is unconditionally decremented at the
end of the function:

	...
	pm_runtime_put_sync(core->dev);
}

Could this cause an underflow if the initial resume failed, leaving the PM
references unbalanced?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260604035133.39825-1-dennylin0707@gmail.com?part=1

      reply	other threads:[~2026-06-04  4:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04  3:51 [PATCH v2] media: qcom: iris: fix runtime PM reference leaks Hungyu Lin
2026-06-04  4:02 ` sashiko-bot [this message]

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=20260604040214.ABC541F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.