Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Maxime Ripard <maxime@cerno.tech>,
	Zhang Qilong <zhangqilong3@huawei.com>,
	devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	paul.kocialkowski@bootlin.com, wens@csie.org, mchehab@kernel.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming
Date: Thu, 5 Nov 2020 13:41:02 +0300	[thread overview]
Message-ID: <20201105104102.GA29398@kadam> (raw)
In-Reply-To: <2eb14a6d-4680-1527-0985-fd371e3ba2e8@xs4all.nl>

On Wed, Nov 04, 2020 at 12:39:11PM +0100, Hans Verkuil wrote:
> On 02/11/2020 15:18, Maxime Ripard wrote:
> > On Mon, Nov 02, 2020 at 10:26:22PM +0800, Zhang Qilong wrote:
> >> pm_runtime_get_sync will increment pm usage counter even it
> >> failed. Forgetting to pm_runtime_put_noidle will result in
> >> reference leak in cedrus_start_streaming. We should fix it.
> >>
> >> Fixes: d5aecd289babf ("media: cedrus: Implement runtime PM")
> >> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> > 
> > Shouldn't we fix pm_runtime_get_sync instead then? It seems that most of
> > the callers get this wrong, and that's definitely non-obvious.
> 
> It's been discussed before, but nobody stepped up to address this
> issue. In the end I decided to just accept media patches that fix this
> in the drivers rather than waiting for some mythical future core fix.
> 
> Nor do I think that you can just 'fix' pm_runtime_get_sync, since
> then you will get cases where pm_runtime_put is called once too
> often.

Someone could easily add a helper function.  The only complication is
thinking of the correct name.

regards,
dan carpenter


      parent reply	other threads:[~2020-11-05 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 14:26 [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming Zhang Qilong
2020-11-02 14:18 ` Maxime Ripard
2020-11-02 14:39   ` 答复: " zhangqilong
2020-11-02 15:12   ` Dan Carpenter
2020-11-04 11:39   ` Hans Verkuil
2020-11-05  8:06     ` 答复: " zhangqilong
2020-11-05 10:41     ` Dan Carpenter [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=20201105104102.GA29398@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=mchehab@kernel.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=wens@csie.org \
    --cc=zhangqilong3@huawei.com \
    /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