* [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference
@ 2014-03-21 12:18 Krzysztof Kozlowski
2014-03-21 12:39 ` [PATCH 2/2] clk: s2mps11: Use of_get_child_by_name Krzysztof Kozlowski
2014-03-25 0:07 ` [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference Mike Turquette
0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2014-03-21 12:18 UTC (permalink / raw)
To: linux-arm-kernel
If parent device does not have of_node set the s2mps11_clk_parse_dt()
returned NULL. This NULL was later passed to of_clk_add_provider() which
dereferenced it in pr_debug() call.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
---
drivers/clk/clk-s2mps11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index 00a3abe103a5..27c83e45eaed 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -130,7 +130,7 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
int i;
if (!iodev->dev->of_node)
- return NULL;
+ return ERR_PTR(-EINVAL);
clk_np = of_find_node_by_name(iodev->dev->of_node, "clocks");
if (!clk_np) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] clk: s2mps11: Use of_get_child_by_name
2014-03-21 12:18 [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference Krzysztof Kozlowski
@ 2014-03-21 12:39 ` Krzysztof Kozlowski
2014-03-25 0:07 ` [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference Mike Turquette
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2014-03-21 12:39 UTC (permalink / raw)
To: linux-arm-kernel
of_find_node_by_name() walks over all nodes and can thus walk outside of
the parent node. Use of_get_child_by_name() instead.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/clk/clk-s2mps11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index 27c83e45eaed..6de6a970c086 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -132,7 +132,7 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
if (!iodev->dev->of_node)
return ERR_PTR(-EINVAL);
- clk_np = of_find_node_by_name(iodev->dev->of_node, "clocks");
+ clk_np = of_get_child_by_name(iodev->dev->of_node, "clocks");
if (!clk_np) {
dev_err(&pdev->dev, "could not find clock sub-node\n");
return ERR_PTR(-EINVAL);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference
2014-03-21 12:18 [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference Krzysztof Kozlowski
2014-03-21 12:39 ` [PATCH 2/2] clk: s2mps11: Use of_get_child_by_name Krzysztof Kozlowski
@ 2014-03-25 0:07 ` Mike Turquette
1 sibling, 0 replies; 3+ messages in thread
From: Mike Turquette @ 2014-03-25 0:07 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Krzysztof Kozlowski (2014-03-21 05:18:17)
> If parent device does not have of_node set the s2mps11_clk_parse_dt()
> returned NULL. This NULL was later passed to of_clk_add_provider() which
> dereferenced it in pr_debug() call.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
I've taken both of these patches into clk-next.
Thanks!
Mike
> Cc: <stable@vger.kernel.org>
> ---
> drivers/clk/clk-s2mps11.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index 00a3abe103a5..27c83e45eaed 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -130,7 +130,7 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev)
> int i;
>
> if (!iodev->dev->of_node)
> - return NULL;
> + return ERR_PTR(-EINVAL);
>
> clk_np = of_find_node_by_name(iodev->dev->of_node, "clocks");
> if (!clk_np) {
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-25 0:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 12:18 [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference Krzysztof Kozlowski
2014-03-21 12:39 ` [PATCH 2/2] clk: s2mps11: Use of_get_child_by_name Krzysztof Kozlowski
2014-03-25 0:07 ` [PATCH 1/2] clk: s2mps11: Fix possible NULL pointer dereference Mike Turquette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox