[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1405995634-3297-3-git-send-email-cdhmanning@gmail.com>
Date: Tue, 22 Jul 2014 14:20:33 +1200
From: Charles Manning <cdhmanning@...il.com>
To: linux-kernel@...r.kernel.org, s.trumtrar@...gutronix.de,
dinguyen@...era.com, cslee@...era.com
Cc: Charles Manning <cdhmanning@...il.com>
Subject: [PATCH 2/3] clk: Prevent a hanging pointer being abused
Clock init structs are normally created on the stack.
If the pointer is left intact after clk_register then there is
opportunity for clk drivers to dereference the pointer.
This was causing a problem in socfpga/clk.c for instance.
Better to NULL out the pointer so it can't be abused.
Signed-off-by: Charles Manning <cdhmanning@...il.com>
---
drivers/clk/clk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ec41922..9e92170 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1973,6 +1973,10 @@ struct clk *__clk_register(struct device *dev, struct clk_hw *hw)
clk->owner = NULL;
ret = __clk_init(dev, clk);
+
+ /* Prevent a hanging pointer being left around. */
+ hw->init = NULL;
+
if (ret)
return ERR_PTR(ret);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists