linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] hwrng: exynos - fix PM reference leak in exynos_trng_probe()
@ 2021-04-09  6:11 Ye Weihua
  2021-04-09  6:17 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Ye Weihua @ 2021-04-09  6:11 UTC (permalink / raw)
  To: l.stelmach, mpm, herbert, krzk
  Cc: linux-samsung-soc, linux-crypto, linux-arm-kernel, linux-kernel,
	yangjihong1, zhangjinhao2

pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Weihua <yeweihua4@huawei.com>
---
 drivers/char/hw_random/exynos-trng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c
index 8e1fe3f8dd2d..666246bc8cca 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -132,7 +132,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
 		return PTR_ERR(trng->mem);
 
 	pm_runtime_enable(&pdev->dev);
-	ret = pm_runtime_get_sync(&pdev->dev);
+	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Could not get runtime PM.\n");
 		goto err_pm_get;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] hwrng: exynos - fix PM reference leak in exynos_trng_probe()
  2021-04-09  6:11 [PATCH -next] hwrng: exynos - fix PM reference leak in exynos_trng_probe() Ye Weihua
@ 2021-04-09  6:17 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-09  6:17 UTC (permalink / raw)
  To: Ye Weihua
  Cc: l.stelmach, mpm, herbert, linux-samsung-soc, linux-crypto,
	linux-arm-kernel, linux-kernel, yangjihong1, zhangjinhao2

On Fri, 9 Apr 2021 at 08:11, Ye Weihua <yeweihua4@huawei.com> wrote:
>
> pm_runtime_get_sync will increment pm usage counter even it failed.
> Forgetting to putting operation will result in reference leak here.
> Fix it by replacing it with pm_runtime_resume_and_get to keep usage
> counter balanced.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Weihua <yeweihua4@huawei.com>

Hi,

The same Lukasz' comment applies here as for Qinglang's patch from
November 2020 - resume also needs fix up.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-09  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  6:11 [PATCH -next] hwrng: exynos - fix PM reference leak in exynos_trng_probe() Ye Weihua
2021-04-09  6:17 ` Krzysztof Kozlowski

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