From: zhangqilong <zhangqilong3@huawei.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: "paul.kocialkowski@bootlin.com" <paul.kocialkowski@bootlin.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"wens@csie.org" <wens@csie.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>
Subject: 答复: [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming
Date: Mon, 2 Nov 2020 14:39:04 +0000 [thread overview]
Message-ID: <f9f6d225275b466b86591ecfdbffb86f@huawei.com> (raw)
In-Reply-To: <20201102141838.7oicqkeqy7vy3ki3@gilmour.lan>
Hi
>
> 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.
>
I have ever thought to fix fix pm_runtime_get_sync, then I went to read the comment on this function, and found that this is what the author intended to do(comment: The possible return values of this function are the same as for pm_runtime_resume() and the runtime PM usage counter of @dev remains incremented in all cases, even if it returns an error code). On the other hand, I found that the number of callers that getting this right is much bigger than getting this wrong even many callers get wrong. So I submit server patches to fix them as I could.
Thanks, best wish!
Zhang Qilong
> Maxime
next prev parent reply other threads:[~2020-11-02 14:39 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 [this message]
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
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=f9f6d225275b466b86591ecfdbffb86f@huawei.com \
--to=zhangqilong3@huawei.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-media@vger.kernel.org \
--cc=maxime@cerno.tech \
--cc=mchehab@kernel.org \
--cc=paul.kocialkowski@bootlin.com \
--cc=wens@csie.org \
/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