[PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming

Dan Carpenter dan.carpenter at oracle.com
Thu Nov 5 10:41:02 UTC 2020


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 at 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



More information about the devel mailing list