stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "hwrng: exynos - Fix unbalanced PM runtime put on timeout error path" has been added to the 4.4-stable tree
@ 2016-06-04 19:18 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-06-04 19:18 UTC (permalink / raw)
  To: k.kozlowski, gregkh, herbert; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    hwrng: exynos - Fix unbalanced PM runtime put on timeout error path

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwrng-exynos-fix-unbalanced-pm-runtime-put-on-timeout-error-path.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From f1925d78d7b710a1179828d53e918295f5f5d222 Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Date: Mon, 14 Mar 2016 09:07:13 +0900
Subject: hwrng: exynos - Fix unbalanced PM runtime put on timeout error path

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit f1925d78d7b710a1179828d53e918295f5f5d222 upstream.

In case of timeout during read operation, the exit path lacked PM
runtime put. This could lead to unbalanced runtime PM usage counter thus
leaving the device in an active state.

Fixes: d7fd6075a205 ("hwrng: exynos - Add timeout for waiting on init done")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/char/hw_random/exynos-rng.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/char/hw_random/exynos-rng.c
+++ b/drivers/char/hw_random/exynos-rng.c
@@ -89,6 +89,7 @@ static int exynos_read(struct hwrng *rng
 						struct exynos_rng, rng);
 	u32 *data = buf;
 	int retry = 100;
+	int ret = 4;
 
 	pm_runtime_get_sync(exynos_rng->dev);
 
@@ -97,17 +98,20 @@ static int exynos_read(struct hwrng *rng
 	while (!(exynos_rng_readl(exynos_rng,
 			EXYNOS_PRNG_STATUS_OFFSET) & PRNG_DONE) && --retry)
 		cpu_relax();
-	if (!retry)
-		return -ETIMEDOUT;
+	if (!retry) {
+		ret = -ETIMEDOUT;
+		goto out;
+	}
 
 	exynos_rng_writel(exynos_rng, PRNG_DONE, EXYNOS_PRNG_STATUS_OFFSET);
 
 	*data = exynos_rng_readl(exynos_rng, EXYNOS_PRNG_OUT1_OFFSET);
 
+out:
 	pm_runtime_mark_last_busy(exynos_rng->dev);
 	pm_runtime_put_sync_autosuspend(exynos_rng->dev);
 
-	return 4;
+	return ret;
 }
 
 static int exynos_rng_probe(struct platform_device *pdev)


Patches currently in stable-queue which might be from k.kozlowski@samsung.com are

queue-4.4/hwrng-exynos-fix-unbalanced-pm-runtime-put-on-timeout-error-path.patch
queue-4.4/pinctrl-exynos5440-use-off-stack-memory-for-pinctrl_gpio_range.patch
queue-4.4/arm-dts-exynos-add-interrupt-line-to-max8997-pmic-on-exynos4210-trats.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-04 19:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-04 19:18 Patch "hwrng: exynos - Fix unbalanced PM runtime put on timeout error path" has been added to the 4.4-stable tree gregkh

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