From: wu000273@umn.edu To: kjlu@umn.edu Cc: wu000273@umn.edu, "Łukasz Stelmach" <l.stelmach@samsung.com>, "Matt Mackall" <mpm@selenic.com>, "Herbert Xu" <herbert@gondor.apana.org.au>, "Arnd Bergmann" <arnd@arndb.de>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Kukjin Kim" <kgene@kernel.org>, "Krzysztof Kozlowski" <krzk@kernel.org>, "Philippe Ombredanne" <pombredanne@nexb.com>, linux-samsung-soc@vger.kernel.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] char: hw_random: Fix a reference count leak. Date: Sat, 13 Jun 2020 16:41:28 -0500 [thread overview] Message-ID: <20200613214128.32665-1-wu000273@umn.edu> (raw) From: Qiushi Wu <wu000273@umn.edu> Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put_sync is not called in error handling paths. Thus replace the jump target "err_pm_get" by "err_clock". Fixes: 6cd225cc5d8a ("hwrng: exynos - add Samsung Exynos True RNG driver") Signed-off-by: Qiushi Wu <wu000273@umn.edu> --- drivers/char/hw_random/exynos-trng.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 8e1fe3f8dd2d..ffa7e0f061f0 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -135,7 +135,7 @@ static int exynos_trng_probe(struct platform_device *pdev) ret = pm_runtime_get_sync(&pdev->dev); if (ret < 0) { dev_err(&pdev->dev, "Could not get runtime PM.\n"); - goto err_pm_get; + goto err_clock; } trng->clk = devm_clk_get(&pdev->dev, "secss"); @@ -166,8 +166,6 @@ static int exynos_trng_probe(struct platform_device *pdev) err_clock: pm_runtime_put_sync(&pdev->dev); - -err_pm_get: pm_runtime_disable(&pdev->dev); return ret; -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: wu000273@umn.edu To: kjlu@umn.edu Cc: linux-samsung-soc@vger.kernel.org, "Herbert Xu" <herbert@gondor.apana.org.au>, "Arnd Bergmann" <arnd@arndb.de>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Philippe Ombredanne" <pombredanne@nexb.com>, "Łukasz Stelmach" <l.stelmach@samsung.com>, linux-kernel@vger.kernel.org, "Krzysztof Kozlowski" <krzk@kernel.org>, "Kukjin Kim" <kgene@kernel.org>, linux-crypto@vger.kernel.org, wu000273@umn.edu, "Matt Mackall" <mpm@selenic.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH] char: hw_random: Fix a reference count leak. Date: Sat, 13 Jun 2020 16:41:28 -0500 [thread overview] Message-ID: <20200613214128.32665-1-wu000273@umn.edu> (raw) From: Qiushi Wu <wu000273@umn.edu> Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put_sync is not called in error handling paths. Thus replace the jump target "err_pm_get" by "err_clock". Fixes: 6cd225cc5d8a ("hwrng: exynos - add Samsung Exynos True RNG driver") Signed-off-by: Qiushi Wu <wu000273@umn.edu> --- drivers/char/hw_random/exynos-trng.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 8e1fe3f8dd2d..ffa7e0f061f0 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -135,7 +135,7 @@ static int exynos_trng_probe(struct platform_device *pdev) ret = pm_runtime_get_sync(&pdev->dev); if (ret < 0) { dev_err(&pdev->dev, "Could not get runtime PM.\n"); - goto err_pm_get; + goto err_clock; } trng->clk = devm_clk_get(&pdev->dev, "secss"); @@ -166,8 +166,6 @@ static int exynos_trng_probe(struct platform_device *pdev) err_clock: pm_runtime_put_sync(&pdev->dev); - -err_pm_get: pm_runtime_disable(&pdev->dev); return ret; -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-06-13 21:41 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-13 21:41 wu000273 [this message] 2020-06-13 21:41 ` [PATCH] char: hw_random: Fix a reference count leak wu000273 2020-06-15 6:58 ` Krzysztof Kozlowski 2020-06-15 6:58 ` Krzysztof Kozlowski [not found] ` <CGME20200615131915eucas1p2b8f3fa0ceb757e36aa888a4476de034f@eucas1p2.samsung.com> 2020-06-15 13:18 ` Lukasz Stelmach 2020-06-15 13:18 ` Lukasz Stelmach 2020-06-16 7:31 ` Herbert Xu 2020-06-16 7:31 ` Herbert Xu
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=20200613214128.32665-1-wu000273@umn.edu \ --to=wu000273@umn.edu \ --cc=arnd@arndb.de \ --cc=gregkh@linuxfoundation.org \ --cc=herbert@gondor.apana.org.au \ --cc=kgene@kernel.org \ --cc=kjlu@umn.edu \ --cc=krzk@kernel.org \ --cc=l.stelmach@samsung.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-crypto@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=mpm@selenic.com \ --cc=pombredanne@nexb.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.