public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH 1/8] clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference
       [not found] <1431500087-2275-1-git-send-email-k.kozlowski@samsung.com>
@ 2015-05-13  6:54 ` Krzysztof Kozlowski
  2015-05-14 22:31   ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2015-05-13  6:54 UTC (permalink / raw)
  To: Tero Kristo, Mike Turquette, Stephen Boyd, linux-omap, linux-clk,
	linux-kernel
  Cc: Krzysztof Kozlowski, stable

of_clk_get_from_provider() returns ERR_PTR on failure. The
dra7-atl-clock driver was not checking its return value and immediately
used it in __clk_get_hw().  __clk_get_hw() dereferences supplied clock,
if it is not NULL, so in that case it would dereference an ERR_PTR.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
---
 drivers/clk/ti/clk-dra7-atl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
index d86bc46b93bd..0a1df821860f 100644
--- a/drivers/clk/ti/clk-dra7-atl.c
+++ b/drivers/clk/ti/clk-dra7-atl.c
@@ -252,6 +252,11 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev)
 		}
 
 		clk = of_clk_get_from_provider(&clkspec);
+		if (IS_ERR(clk)) {
+			pr_err("%s: failed to get atl clock %d from provider\n",
+			       __func__, i);
+			return PTR_ERR(clk);
+		}
 
 		cdesc = to_atl_desc(__clk_get_hw(clk));
 		cdesc->cinfo = cinfo;
-- 
1.9.1


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

* Re: [RFT PATCH 1/8] clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference
  2015-05-13  6:54 ` [RFT PATCH 1/8] clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference Krzysztof Kozlowski
@ 2015-05-14 22:31   ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2015-05-14 22:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Tero Kristo, Mike Turquette, linux-omap, linux-clk, linux-kernel,
	stable

On 05/13, Krzysztof Kozlowski wrote:
> of_clk_get_from_provider() returns ERR_PTR on failure. The
> dra7-atl-clock driver was not checking its return value and immediately
> used it in __clk_get_hw().  __clk_get_hw() dereferences supplied clock,
> if it is not NULL, so in that case it would dereference an ERR_PTR.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: <stable@vger.kernel.org>
> Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2015-05-14 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1431500087-2275-1-git-send-email-k.kozlowski@samsung.com>
2015-05-13  6:54 ` [RFT PATCH 1/8] clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference Krzysztof Kozlowski
2015-05-14 22:31   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox