ARM: EXYNOS: Fix potentian kfree() of ro memory
authorVladimir Zapolskiy <vz@mleia.com>
Fri, 31 Jul 2015 00:09:49 +0000 (03:09 +0300)
committerKrzysztof Kozlowski <k.kozlowski@samsung.com>
Fri, 31 Jul 2015 01:11:25 +0000 (10:11 +0900)
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 in power domain error
exit path.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Cc: <stable@vger.kernel.org>
Fixes: 2be2a3ff42a5 ("ARM: EXYNOS: register power domain driver from core_initcall")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
arch/arm/mach-exynos/pm_domains.c

index 6001f1c9d136f45fabd7d61e97638855d0beb46a..5121baae0e6b665338972664426dea67211eac71 100644 (file)
@@ -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;