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,  8 Nov 2016 13:53:50 +0530
From:   Rajendra Nayak <rnayak@...eaurora.org>
To:     sboyd@...eaurora.org, mturquette@...libre.com
Cc:     linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        Rajendra Nayak <rnayak@...eaurora.org>
Subject: [PATCH] clk: Free struct clk allocated during clk_hw_register()

With clk_hw_register() API we hide the struct clk from the caller
and return an int error code instead, so the caller (clk provider)
is not expected to use hw->clk on return.
Free the memory, and mark hw->clk as NULL before returning.

Signed-off-by: Rajendra Nayak <rnayak@...eaurora.org>
---
 drivers/clk/clk.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0fb39fe..f81e4aa 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2628,7 +2628,15 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw)
  */
 int clk_hw_register(struct device *dev, struct clk_hw *hw)
 {
-	return PTR_ERR_OR_ZERO(clk_register(dev, hw));
+	struct clk *c;
+
+	c = clk_register(dev, hw);
+	if (IS_ERR(c))
+		return PTR_ERR(c);
+
+	__clk_free_clk(c);
+	hw->clk = NULL;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(clk_hw_register);
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ