From: Rusty Russell <rusty@rustcorp.com.au>
To: Xiaotian Feng <xtfeng@gmail.com>, Peter Zijlstra <peterz@infradead.org>
Cc: Xiaotian Feng <xtfeng@gmail.com>, Ingo Molnar <mingo@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpumask: fix cpumask leak in partition_sched_domains
Date: Tue, 06 Aug 2013 14:07:37 +0930 [thread overview]
Message-ID: <87d2prqvse.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAJn8CcF4E6JiRrU6gaawQSnzR9GsQaOy+1yo=+dFmSoy=hSodQ@mail.gmail.com>
Xiaotian Feng <xtfeng@gmail.com> writes:
> On Sat, Jul 27, 2013 at 3:26 PM, Xiaotian Feng <xtfeng@gmail.com> wrote:
>> 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: Ingo Molnar <mingo@redhat.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: linux-kernel@vger.kernel.org
>
> Any comments? Cc'ed Rusty.
The code is a little convoluted, but your fix is logical.
>> ---
>> kernel/sched/core.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index b7c32cb..3d6c57b 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -6184,8 +6184,9 @@ match1:
>> ;
>> }
>>
>> + n= ndoms_cur;
You're missing a ' ' here:
n = ndoms_cur;
>> if (doms_new == NULL) {
>> - ndoms_cur = 0;
>> + n = 0;
>> doms_new = &fallback_doms;
>> cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map);
>> WARN_ON_ONCE(dattr_new);
>> @@ -6193,7 +6194,7 @@ match1:
>>
>> /* Build new domains */
>> for (i = 0; i < ndoms_new; i++) {
>> - for (j = 0; j < ndoms_cur && !new_topology; j++) {
>> + for (j = 0; j < n && !new_topology; j++) {
>> if (cpumask_equal(doms_new[i], doms_cur[j])
>> && dattrs_equal(dattr_new, i, dattr_cur, j))
>> goto match2;
>> --
>> 1.7.9.6 (Apple Git-31.1)
>>
Cheers,
Rusty.
next prev parent reply other threads:[~2013-08-06 4:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-27 7:26 [PATCH] cpumask: fix cpumask leak in partition_sched_domains Xiaotian Feng
2013-08-06 2:31 ` Xiaotian Feng
2013-08-06 4:37 ` Rusty Russell [this message]
2013-08-06 5:10 ` Xiaotian Feng
2013-08-06 12:06 ` Xiaotian Feng
2013-08-15 1:55 ` Xiaotian Feng
2013-08-15 9:09 ` Peter Zijlstra
2013-08-16 18:46 ` [tip:sched/core] cpumask: Fix cpumask leak in partition_sched_domains() tip-bot for Xiaotian Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d2prqvse.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=xtfeng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox