All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: EXYNOS: pd: fix resource deallocation on error path
@ 2015-07-29 20:15 ` Vladimir Zapolskiy
  0 siblings, 0 replies; 12+ messages in thread
From: Vladimir Zapolskiy @ 2015-07-29 20:15 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-samsung-soc, Russell King, linux-arm-kernel, Marek Szyprowski

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.

Also remove unneeded of_node_put(), if for_each_compatible_node() body
execution is not terminated, this prevents from double kfree() in
OF_DYNAMIC build.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 arch/arm/mach-exynos/pm_domains.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 6001f1c..4a87e86 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -146,9 +146,8 @@ 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] 12+ messages in thread

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 20:15 [PATCH] ARM: EXYNOS: pd: fix resource deallocation on error path Vladimir Zapolskiy
2015-07-29 20:15 ` Vladimir Zapolskiy
2015-07-29 23:37 ` Krzysztof Kozlowski
2015-07-29 23:37   ` Krzysztof Kozlowski
2015-07-30  0:06   ` Vladimir Zapolskiy
2015-07-30  0:06     ` Vladimir Zapolskiy
2015-07-30  0:15     ` Krzysztof Kozlowski
2015-07-30  0:15       ` Krzysztof Kozlowski
2015-07-30  0:35       ` Vladimir Zapolskiy
2015-07-30  0:35         ` Vladimir Zapolskiy
2015-07-30  0:55         ` Krzysztof Kozlowski
2015-07-30  0:55           ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.