lkml.org 
[lkml]   [2017]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] sched/core: Fix &rd->cpudl memory leak
Date
While in the process of initialising a root domain, if function
cpupri_init() fails the memory allocated in cpudl_init() is not
reclaimed.

Adding a new goto target to cleanup the previous initialistion of
the root_domain's dl_bw structure reclaims said memory.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
kernel/sched/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5c01ac0f915a..f06ce70757a7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5884,9 +5884,11 @@ static int init_rootdomain(struct root_domain *rd)
goto free_rto_mask;

if (cpupri_init(&rd->cpupri) != 0)
- goto free_rto_mask;
+ goto free_cpudl;
return 0;

+free_cpudl:
+ cpudl_cleanup(&rd->cpudl);
free_rto_mask:
free_cpumask_var(rd->rto_mask);
free_dlo_mask:
--
2.7.4
\
 
 \ /
  Last update: 2017-01-24 22:12    [W:0.053 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site