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

zhangqilong zhangqilong3 at huawei.com
Mon Nov 2 14:39:04 UTC 2020


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

 
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


More information about the devel mailing list