From: Hans Verkuil <hverkuil@xs4all.nl>
To: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Cc: wu000273@umn.edu, kjlu@umn.edu,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: sti: Fix reference count leaks
Date: Thu, 17 Sep 2020 13:40:31 +0200 [thread overview]
Message-ID: <013fba3b-2451-855b-08d4-87682464b8bf@xs4all.nl> (raw)
In-Reply-To: <20200614033106.426-1-wu000273@umn.edu>
Hi Jean-Christophe,
I'll take this patch, but while reviewing it I noticed something else:
On 14/06/2020 05:31, wu000273@umn.edu wrote:
> From: Qiushi Wu <wu000273@umn.edu>
>
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code, causing incorrect ref count if
> pm_runtime_put_noidle() is not called in error handling paths.
> Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.
>
> Signed-off-by: Qiushi Wu <wu000273@umn.edu>
> ---
> drivers/media/platform/sti/hva/hva-hw.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c
> index 401aaafa1710..bb13348be083 100644
> --- a/drivers/media/platform/sti/hva/hva-hw.c
> +++ b/drivers/media/platform/sti/hva/hva-hw.c
> @@ -272,6 +272,7 @@ static unsigned long int hva_hw_get_ip_version(struct hva_dev *hva)
>
> if (pm_runtime_get_sync(dev) < 0) {
> dev_err(dev, "%s failed to get pm_runtime\n", HVA_PREFIX);
> + pm_runtime_put_noidle(dev);
> mutex_unlock(&hva->protect_mutex);
This appears to be a spurious mutex_unlock() since I don't see a corresponding mutex_lock.
Jean-Christophe, can you check this and, if I am right, post a patch fixing this?
Regards,
Hans
> return -EFAULT;
> }
> @@ -553,6 +554,7 @@ void hva_hw_dump_regs(struct hva_dev *hva, struct seq_file *s)
>
> if (pm_runtime_get_sync(dev) < 0) {
> seq_puts(s, "Cannot wake up IP\n");
> + pm_runtime_put_noidle(dev);
> mutex_unlock(&hva->protect_mutex);
> return;
> }
>
next prev parent reply other threads:[~2020-09-17 11:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-14 3:31 [PATCH] media: sti: Fix reference count leaks wu000273
2020-09-17 11:40 ` Hans Verkuil [this message]
2021-04-21 13:29 ` Krzysztof Kozlowski
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=013fba3b-2451-855b-08d4-87682464b8bf@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=jean-christophe.trotin@st.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=wu000273@umn.edu \
/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;
as well as URLs for NNTP newsgroup(s).