From: tip-bot for Mike Galbraith <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, umgwanakikbuti@gmail.com, lizefan@huawei.com,
peterz@infradead.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, hpa@zytor.com,
torvalds@linux-foundation.org
Subject: [tip:sched/urgent] sched: Fix crash if cpuset_cpumask_can_shrink( ) is passed an empty cpumask
Date: Wed, 28 Jan 2015 06:33:34 -0800 [thread overview]
Message-ID: <tip-bb2bc55a694d45cdeda91b6f28ab2adec28125ef@git.kernel.org> (raw)
In-Reply-To: <1422417235.5716.5.camel@marge.simpson.net>
Commit-ID: bb2bc55a694d45cdeda91b6f28ab2adec28125ef
Gitweb: http://git.kernel.org/tip/bb2bc55a694d45cdeda91b6f28ab2adec28125ef
Author: Mike Galbraith <umgwanakikbuti@gmail.com>
AuthorDate: Wed, 28 Jan 2015 04:53:55 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 28 Jan 2015 15:28:15 +0100
sched: Fix crash if cpuset_cpumask_can_shrink() is passed an empty cpumask
While creating an exclusive cpuset, we passed cpuset_cpumask_can_shrink()
an empty cpumask (cur), and dl_bw_of(cpumask_any(cur)) made boom with it:
CPU: 0 PID: 6942 Comm: shield.sh Not tainted 3.19.0-master #19
Hardware name: MEDIONPC MS-7502/MS-7502, BIOS 6.00 PG 12/26/2007
task: ffff880224552450 ti: ffff8800caab8000 task.ti: ffff8800caab8000
RIP: 0010:[<ffffffff81073846>] [<ffffffff81073846>] cpuset_cpumask_can_shrink+0x56/0xb0
[...]
Call Trace:
[<ffffffff810cb82a>] validate_change+0x18a/0x200
[<ffffffff810cc877>] cpuset_write_resmask+0x3b7/0x720
[<ffffffff810c4d58>] cgroup_file_write+0x38/0x100
[<ffffffff811d953a>] kernfs_fop_write+0x12a/0x180
[<ffffffff8116e1a3>] vfs_write+0xb3/0x1d0
[<ffffffff8116ed06>] SyS_write+0x46/0xb0
[<ffffffff8159ced6>] system_call_fastpath+0x16/0x1b
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Acked-by: Zefan Li <lizefan@huawei.com>
Fixes: f82f80426f7a ("sched/deadline: Ensure that updates to exclusive cpusets don't break AC")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1422417235.5716.5.camel@marge.simpson.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c0accc0..5c86687 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4642,6 +4642,9 @@ int cpuset_cpumask_can_shrink(const struct cpumask *cur,
struct dl_bw *cur_dl_b;
unsigned long flags;
+ if (!cpumask_weight(cur))
+ return ret;
+
rcu_read_lock_sched();
cur_dl_b = dl_bw_of(cpumask_any(cur));
trial_cpus = cpumask_weight(trial);
prev parent reply other threads:[~2015-01-28 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 6:16 [patch] cpuset: fix crash when adding CPUs to an empty set Mike Galbraith
2015-01-28 2:41 ` Zefan Li
2015-01-28 3:53 ` Mike Galbraith
2015-01-28 4:24 ` Zefan Li
2015-01-28 11:53 ` Peter Zijlstra
2015-01-28 12:03 ` Mike Galbraith
2015-01-28 14:33 ` tip-bot for Mike Galbraith [this message]
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=tip-bb2bc55a694d45cdeda91b6f28ab2adec28125ef@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=umgwanakikbuti@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
Powered by JetHome