pd: fix resource deallocation on error path
Subsystems (4)
v2 cover pd: fix resource deallocation on error path
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(-)
Signature · 1 line
2.1.4
PATCH v2 1/2 ARM: EXYNOS: pd: fix potentian kfree() of ro memory
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.
---
Changes from v1 to v2:
* split a single change v1 into two
* added Fixes tag and Cc: <[email protected]>
arch/arm/mach-exynos/pm_domains.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-exynos/pm_domains.c +1 -1
@@ -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 ;
Signature · 1 line
2.1.4
PATCH v2 1/2 ARM: EXYNOS: pd: fix potentian kfree() of ro memory
Quoted 7 lines · Vladimir Zapolskiy
The change fixes a bug introduced by
2be2a3ff42a5, memory allocated bykstrdup_const()must be always deallocated withkfree_const(), otherwise there is a risk of kfree'ing ro memory.Signed-off-by Vladimir Zapolskiy <[email protected]>Cc <[email protected]>Fixes 2be2a3ff42a5 ("ARM: EXYNOS: register power domain driver from core_initcall")
Quoted 7 lines
---
Changes from v1 to v2:
* split a single change v1 into two
* added Fixes tag and Cc: <[email protected]>arch/arm/mach-exynos/pm_domains.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Best regards,
Krzysztof
PATCH v2 2/2 ARM: EXYNOS: fix double of_node_put() on error path
In reply to Vladimir ZapolskiyThe 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.
---
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(-)
arch/arm/mach-exynos/pm_domains.c +0 -1
@@ -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 ; }
Signature · 1 line
2.1.4
PATCH v2 2/2 ARM: EXYNOS: fix double of_node_put() on error path
Quoted 5 lines · Vladimir Zapolskiy
The change removes the second
of_node_put(), iffor_each_compatible_node()body execution is not terminated. This prevents from object refcounter overflow over zero inOF_DYNAMICbuild.
Quoted 8 lines
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* split a single change v1 into twoarch/arm/mach-exynos/pm_domains.c | 1 - 1 file changed, 1 deletion(-)
Best regards,
Krzysztof