* [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned by of_genpd_get_from_provider
@ 2015-05-13 3:17 Krzysztof Kozlowski
2015-05-13 8:44 ` [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned byof_genpd_get_from_provider Kukjin Kim
0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2015-05-13 3:17 UTC (permalink / raw)
To: linux-arm-kernel
ERR_PTR was dereferenced during sub domain parsing, if parent domain
could not be obtained (because of invalid phandle or deferred
registration of parent domain).
The Exynos power domain code checked whether
of_genpd_get_from_provider() returned NULL and in that case it skipped
that power domain node. However this function returns ERR_PTR or valid
pointer, not NULL.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 0f7807518fe1 ("ARM: EXYNOS: add support for sub-power domains")
---
The patchset is rebased on top of my fixes for pm_domains.c to avoid the
conflicts:
https://lkml.org/lkml/2015/3/27/321
---
arch/arm/mach-exynos/pm_domains.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 1a90c5da2fd7..440324c94d28 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -209,7 +209,7 @@ no_clk:
args.np = np;
args.args_count = 0;
child_domain = of_genpd_get_from_provider(&args);
- if (!child_domain)
+ if (IS_ERR(child_domain))
goto next_pd;
if (of_parse_phandle_with_args(np, "power-domains",
@@ -217,7 +217,7 @@ no_clk:
goto next_pd;
parent_domain = of_genpd_get_from_provider(&args);
- if (!parent_domain)
+ if (IS_ERR(parent_domain))
goto next_pd;
if (pm_genpd_add_subdomain(parent_domain, child_domain))
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned byof_genpd_get_from_provider
2015-05-13 3:17 [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned by of_genpd_get_from_provider Krzysztof Kozlowski
@ 2015-05-13 8:44 ` Kukjin Kim
2015-05-13 10:01 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Kukjin Kim @ 2015-05-13 8:44 UTC (permalink / raw)
To: linux-arm-kernel
On 05/13/15 12:17, Krzysztof Kozlowski wrote:
> ERR_PTR was dereferenced during sub domain parsing, if parent domain
> could not be obtained (because of invalid phandle or deferred
> registration of parent domain).
>
> The Exynos power domain code checked whether
> of_genpd_get_from_provider() returned NULL and in that case it skipped
> that power domain node. However this function returns ERR_PTR or valid
> pointer, not NULL.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: <stable@vger.kernel.org>
Maybe [4.0+]? but as you mentioned this patch has a dependency with
Patch "ARM: EXYNOS: Add missing of_node_put() when parsing power domain"
and it means this cannot be applied into stable tree...
So I'll apply this patch firstly then please re-submit them I've missed
before based on samsung tree. I think, it would be better...
> Fixes: 0f7807518fe1 ("ARM: EXYNOS: add support for sub-power domains")
>
> ---
>
> The patchset is rebased on top of my fixes for pm_domains.c to avoid the
> conflicts:
> https://lkml.org/lkml/2015/3/27/321
> ---
> arch/arm/mach-exynos/pm_domains.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
> index 1a90c5da2fd7..440324c94d28 100644
> --- a/arch/arm/mach-exynos/pm_domains.c
> +++ b/arch/arm/mach-exynos/pm_domains.c
> @@ -209,7 +209,7 @@ no_clk:
> args.np = np;
> args.args_count = 0;
> child_domain = of_genpd_get_from_provider(&args);
> - if (!child_domain)
> + if (IS_ERR(child_domain))
> goto next_pd;
>
> if (of_parse_phandle_with_args(np, "power-domains",
> @@ -217,7 +217,7 @@ no_clk:
> goto next_pd;
>
> parent_domain = of_genpd_get_from_provider(&args);
> - if (!parent_domain)
> + if (IS_ERR(parent_domain))
> goto next_pd;
>
> if (pm_genpd_add_subdomain(parent_domain, child_domain))
Applied into fixes with resolving conflict.
Thanks,
Kukjin
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned byof_genpd_get_from_provider
2015-05-13 8:44 ` [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned byof_genpd_get_from_provider Kukjin Kim
@ 2015-05-13 10:01 ` Krzysztof Kozlowski
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2015-05-13 10:01 UTC (permalink / raw)
To: linux-arm-kernel
2015-05-13 17:44 GMT+09:00 Kukjin Kim <kgene@kernel.org>:
> On 05/13/15 12:17, Krzysztof Kozlowski wrote:
>> ERR_PTR was dereferenced during sub domain parsing, if parent domain
>> could not be obtained (because of invalid phandle or deferred
>> registration of parent domain).
>>
>> The Exynos power domain code checked whether
>> of_genpd_get_from_provider() returned NULL and in that case it skipped
>> that power domain node. However this function returns ERR_PTR or valid
>> pointer, not NULL.
>>
>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>> Cc: <stable@vger.kernel.org>
>
> Maybe [4.0+]? but as you mentioned this patch has a dependency with
Tag fixes with commit ID is sufficient for stable backporting.
> Patch "ARM: EXYNOS: Add missing of_node_put() when parsing power domain"
> and it means this cannot be applied into stable tree...
>
> So I'll apply this patch firstly then please re-submit them I've missed
> before based on samsung tree. I think, it would be better...
>
>> Fixes: 0f7807518fe1 ("ARM: EXYNOS: add support for sub-power domains")
I will get an notification when this patch won't apply to stable tree
(like v4.0) because of conflicts. Then usually I fix/rebase the patch
and send to the stable tree. So don't worry about this, I will handle
the backport.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-13 10:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13 3:17 [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned by of_genpd_get_from_provider Krzysztof Kozlowski
2015-05-13 8:44 ` [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned byof_genpd_get_from_provider Kukjin Kim
2015-05-13 10:01 ` Krzysztof Kozlowski
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).