[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210409061125.214255-1-yeweihua4@huawei.com>
Date: Fri, 9 Apr 2021 14:11:25 +0800
From: Ye Weihua <yeweihua4@...wei.com>
To: <l.stelmach@...sung.com>, <mpm@...enic.com>,
<herbert@...dor.apana.org.au>, <krzk@...nel.org>
CC: <linux-samsung-soc@...r.kernel.org>,
<linux-crypto@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <yangjihong1@...wei.com>,
<zhangjinhao2@...wei.com>
Subject: [PATCH -next] hwrng: exynos - fix PM reference leak in exynos_trng_probe()
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@...wei.com>
Signed-off-by: Ye Weihua <yeweihua4@...wei.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
Powered by blists - more mailing lists