lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 May 2018 10:50:17 +1000
From:   James Kelly <jamespeterkelly@...il.com>
To:     Mark Brown <broonie@...nel.org>
Cc:     James Kelly <jamespeterkelly@...il.com>,
        Maxime Ripard <maxime.ripard@...e-electrons.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] Skip clk_put for attached clocks when freeing context

Capability to attach an existing clk to a MMIO regmap was
introduced in 4.17rc1.

However, when using attached clk, regmap does not do the clk_get.
Therefore it should not do the clk_put when freeing the MMIO
regmap context.

There does not appear to be any users of attached clocks yet
so this would be a good time to make this change before anything
depends on the existing behaviour.

Signed-off-by: James Kelly <jamespeterkelly@...il.com>
---
 drivers/base/regmap/regmap-mmio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 5cadfd3394d8..8741fb5f8f54 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -206,7 +206,8 @@ static void regmap_mmio_free_context(void *context)
 
 	if (!IS_ERR(ctx->clk)) {
 		clk_unprepare(ctx->clk);
-		clk_put(ctx->clk);
+		if (!ctx->attached_clk)
+			clk_put(ctx->clk);
 	}
 	kfree(context);
 }
-- 
2.15.1 (Apple Git-101)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ