linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Jean-Christophe Trotin <jean-christophe.trotin@st.com>,
	wu000273@umn.edu, kjlu@umn.edu,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: sti: Fix reference count leaks
Date: Wed, 21 Apr 2021 15:29:21 +0200	[thread overview]
Message-ID: <CAJKOXPc2_J-_m_e0+xGW=RHgx6p67yMTTfQhjVkEHUmVB5DGzQ@mail.gmail.com> (raw)
In-Reply-To: <013fba3b-2451-855b-08d4-87682464b8bf@xs4all.nl>

On Thu, 17 Sept 2020 at 13:45, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>
> 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?

Probably patch should be skipped due to uncertain intentions:
https://lore.kernel.org/linux-nfs/YH+7ZydHv4+Y1hlx@kroah.com/

Best regards,
Krzysztof

      reply	other threads:[~2021-04-21 13:29 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
2021-04-21 13:29   ` Krzysztof Kozlowski [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='CAJKOXPc2_J-_m_e0+xGW=RHgx6p67yMTTfQhjVkEHUmVB5DGzQ@mail.gmail.com' \
    --to=krzk@kernel.org \
    --cc=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).