diff options
author | Xiaotian Feng <xtfeng@gmail.com> | 2013-08-06 08:06:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-08-16 11:44:27 -0400 |
commit | c8d2d47a9cbb4222ae4e993aa0e3703430c8193c (patch) | |
tree | d522413abcf9c69d3ceef66e7dc4708560812645 /kernel/sched | |
parent | d3ec3a1fd08f705d1b319db4113590944bcde749 (diff) |
cpumask: Fix cpumask leak in partition_sched_domains()
If doms_new is NULL, partition_sched_domains() will reset ndoms_cur
to 0, and free old sched domains with free_sched_domains(doms_cur, ndoms_cur).
As ndoms_cur is 0, the cpumask will not be freed.
Signed-off-by: Xiaotian Feng <xtfeng@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1375790802-11857-1-git-send-email-xtfeng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b7415cfdd7de..cf8f100433e0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -6184,8 +6184,9 @@ match1: | |||
6184 | ; | 6184 | ; |
6185 | } | 6185 | } |
6186 | 6186 | ||
6187 | n = ndoms_cur; | ||
6187 | if (doms_new == NULL) { | 6188 | if (doms_new == NULL) { |
6188 | ndoms_cur = 0; | 6189 | n = 0; |
6189 | doms_new = &fallback_doms; | 6190 | doms_new = &fallback_doms; |
6190 | cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map); | 6191 | cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map); |
6191 | WARN_ON_ONCE(dattr_new); | 6192 | WARN_ON_ONCE(dattr_new); |
@@ -6193,7 +6194,7 @@ match1: | |||
6193 | 6194 | ||
6194 | /* Build new domains */ | 6195 | /* Build new domains */ |
6195 | for (i = 0; i < ndoms_new; i++) { | 6196 | for (i = 0; i < ndoms_new; i++) { |
6196 | for (j = 0; j < ndoms_cur && !new_topology; j++) { | 6197 | for (j = 0; j < n && !new_topology; j++) { |
6197 | if (cpumask_equal(doms_new[i], doms_cur[j]) | 6198 | if (cpumask_equal(doms_new[i], doms_cur[j]) |
6198 | && dattrs_equal(dattr_new, i, dattr_cur, j)) | 6199 | && dattrs_equal(dattr_new, i, dattr_cur, j)) |
6199 | goto match2; | 6200 | goto match2; |