linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.14 01/13] clk: ti: clkctrl: Fix returning uninitialized data
@ 2019-07-03  2:18 Sasha Levin
  2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 02/13] efi/bgrt: Drop BGRT status field reserved bits check Sasha Levin
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Sasha Levin @ 2019-07-03  2:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tony Lindgren, Tomi Valkeinen, Peter Ujfalusi, Stephen Boyd,
	Sasha Levin, linux-omap, linux-clk

From: Tony Lindgren <tony@atomide.com>

[ Upstream commit 41b3588dba6ef4b7995735a97e47ff0aeea6c276 ]

If we do a clk_get() for a clock that does not exists, we have
_ti_omap4_clkctrl_xlate() return uninitialized data if no match
is found. This can be seen in some cases with SLAB_DEBUG enabled:

Unable to handle kernel paging request at virtual address 5a5a5a5a
...
clk_hw_create_clk.part.33
sysc_notifier_call
notifier_call_chain
blocking_notifier_call_chain
device_add

Let's fix this by setting a found flag only when we find a match.

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Fixes: 88a172526c32 ("clk: ti: add support for clkctrl clocks")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/ti/clkctrl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 82e4d5cccf84..2df8564f08a0 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -215,6 +215,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
 {
 	struct omap_clkctrl_provider *provider = data;
 	struct omap_clkctrl_clk *entry;
+	bool found = false;
 
 	if (clkspec->args_count != 2)
 		return ERR_PTR(-EINVAL);
@@ -224,11 +225,13 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
 
 	list_for_each_entry(entry, &provider->clocks, node) {
 		if (entry->reg_offset == clkspec->args[0] &&
-		    entry->bit_offset == clkspec->args[1])
+		    entry->bit_offset == clkspec->args[1]) {
+			found = true;
 			break;
+		}
 	}
 
-	if (!entry)
+	if (!found)
 		return ERR_PTR(-EINVAL);
 
 	return entry->clk;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-07-03  2:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03  2:18 [PATCH AUTOSEL 4.14 01/13] clk: ti: clkctrl: Fix returning uninitialized data Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 02/13] efi/bgrt: Drop BGRT status field reserved bits check Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 03/13] perf/core: Fix perf_sample_regs_user() mm check Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 04/13] ARM: omap2: remove incorrect __init annotation Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 05/13] be2net: fix link failure after ethtool offline test Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 06/13] ppp: mppe: Add softdep to arc4 Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 07/13] net: stmmac: fixed new system time seconds value calculation Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 08/13] sis900: fix TX completion Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 09/13] ARM: dts: imx6ul: fix PWM[1-4] interrupts Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 10/13] dm verity: use message limit for data block corruption message Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 11/13] x86/boot/64: Fix crash if kernel image crosses page table boundary Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 12/13] cpu/hotplug: Fix out-of-bounds read when setting fail state Sasha Levin
2019-07-03  2:18 ` [PATCH AUTOSEL 4.14 13/13] linux/kernel.h: fix overflow for DIV_ROUND_UP_ULL Sasha Levin

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