linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] pd: fix resource deallocation on error path
@ 2015-07-31  0:09 Vladimir Zapolskiy
  2015-07-31  0:09 ` [PATCH v2 1/2] ARM: EXYNOS: pd: fix potentian kfree() of ro memory Vladimir Zapolskiy
  2015-07-31  0:09 ` [PATCH v2 2/2] ARM: EXYNOS: fix double of_node_put() on error path Vladimir Zapolskiy
  0 siblings, 2 replies; 5+ messages in thread
From: Vladimir Zapolskiy @ 2015-07-31  0:09 UTC (permalink / raw)
  To: linux-arm-kernel

The first change fixes a bug introduced by 2be2a3ff42a5, memory
allocated by kstrdup_const() must be always deallocated with
kfree_const(), otherwise there is a risk of kfree'ing ro memory.

The second change removes double of_node_put(), if
for_each_compatible_node() body execution is not terminated. This
prevents from object refcounter overflow over zero in OF_DYNAMIC
build.

Vladimir Zapolskiy (2):
  ARM: EXYNOS: pd: fix potentian kfree() of ro memory
  ARM: EXYNOS: fix double of_node_put() on error path

 arch/arm/mach-exynos/pm_domains.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.1.4

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

* [PATCH v2 1/2] ARM: EXYNOS: pd: fix potentian kfree() of ro memory
  2015-07-31  0:09 [PATCH v2 0/2] pd: fix resource deallocation on error path Vladimir Zapolskiy
@ 2015-07-31  0:09 ` Vladimir Zapolskiy
  2015-07-31  0:38   ` Krzysztof Kozlowski
  2015-07-31  0:09 ` [PATCH v2 2/2] ARM: EXYNOS: fix double of_node_put() on error path Vladimir Zapolskiy
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Zapolskiy @ 2015-07-31  0:09 UTC (permalink / raw)
  To: linux-arm-kernel

The change fixes a bug introduced by 2be2a3ff42a5, memory allocated
by kstrdup_const() must be always deallocated with kfree_const(),
otherwise there is a risk of kfree'ing ro memory.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Cc: <stable@vger.kernel.org>
Fixes: 2be2a3ff42a5 ("ARM: EXYNOS: register power domain driver from core_initcall")
---
Changes from v1 to v2:
* split a single change v1 into two
* added Fixes tag and Cc: <stable@vger.kernel.org>

 arch/arm/mach-exynos/pm_domains.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 6001f1c..5121baa 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -146,7 +146,7 @@ static __init int exynos4_pm_init_power_domain(void)
 		pd->base = of_iomap(np, 0);
 		if (!pd->base) {
 			pr_warn("%s: failed to map memory\n", __func__);
-			kfree(pd->pd.name);
+			kfree_const(pd->pd.name);
 			kfree(pd);
 			of_node_put(np);
 			continue;
-- 
2.1.4

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

* [PATCH v2 2/2] ARM: EXYNOS: fix double of_node_put() on error path
  2015-07-31  0:09 [PATCH v2 0/2] pd: fix resource deallocation on error path Vladimir Zapolskiy
  2015-07-31  0:09 ` [PATCH v2 1/2] ARM: EXYNOS: pd: fix potentian kfree() of ro memory Vladimir Zapolskiy
@ 2015-07-31  0:09 ` Vladimir Zapolskiy
  2015-07-31  0:39   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Zapolskiy @ 2015-07-31  0:09 UTC (permalink / raw)
  To: linux-arm-kernel

The change removes the second of_node_put(), if
for_each_compatible_node() body execution is not terminated. This
prevents from object refcounter overflow over zero in OF_DYNAMIC
build.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
Changes from v1 to v2:
* split a single change v1 into two

 arch/arm/mach-exynos/pm_domains.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 5121baa..4a87e86 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -148,7 +148,6 @@ static __init int exynos4_pm_init_power_domain(void)
 			pr_warn("%s: failed to map memory\n", __func__);
 			kfree_const(pd->pd.name);
 			kfree(pd);
-			of_node_put(np);
 			continue;
 		}
 
-- 
2.1.4

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

* [PATCH v2 1/2] ARM: EXYNOS: pd: fix potentian kfree() of ro memory
  2015-07-31  0:09 ` [PATCH v2 1/2] ARM: EXYNOS: pd: fix potentian kfree() of ro memory Vladimir Zapolskiy
@ 2015-07-31  0:38   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-31  0:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 31.07.2015 09:09, Vladimir Zapolskiy wrote:
> The change fixes a bug introduced by 2be2a3ff42a5, memory allocated
> by kstrdup_const() must be always deallocated with kfree_const(),
> otherwise there is a risk of kfree'ing ro memory.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Cc: <stable@vger.kernel.org>
> Fixes: 2be2a3ff42a5 ("ARM: EXYNOS: register power domain driver from core_initcall")
> ---
> Changes from v1 to v2:
> * split a single change v1 into two
> * added Fixes tag and Cc: <stable@vger.kernel.org>
> 
>  arch/arm/mach-exynos/pm_domains.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH v2 2/2] ARM: EXYNOS: fix double of_node_put() on error path
  2015-07-31  0:09 ` [PATCH v2 2/2] ARM: EXYNOS: fix double of_node_put() on error path Vladimir Zapolskiy
@ 2015-07-31  0:39   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-31  0:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 31.07.2015 09:09, Vladimir Zapolskiy wrote:
> The change removes the second of_node_put(), if
> for_each_compatible_node() body execution is not terminated. This
> prevents from object refcounter overflow over zero in OF_DYNAMIC
> build.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---
> Changes from v1 to v2:
> * split a single change v1 into two
> 
>  arch/arm/mach-exynos/pm_domains.c | 1 -
>  1 file changed, 1 deletion(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

end of thread, other threads:[~2015-07-31  0:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31  0:09 [PATCH v2 0/2] pd: fix resource deallocation on error path Vladimir Zapolskiy
2015-07-31  0:09 ` [PATCH v2 1/2] ARM: EXYNOS: pd: fix potentian kfree() of ro memory Vladimir Zapolskiy
2015-07-31  0:38   ` Krzysztof Kozlowski
2015-07-31  0:09 ` [PATCH v2 2/2] ARM: EXYNOS: fix double of_node_put() on error path Vladimir Zapolskiy
2015-07-31  0:39   ` 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).