diff options
author | Andrew Morton <akpm@osdl.org> | 2004-05-09 23:30:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-09 23:30:12 -0700 |
commit | 870d3c0a86538c98d81849fa58d13f443d30ca2c (patch) | |
tree | 987fdf43548d457f9ff7bc1bd2d98284254c6d83 /kernel | |
parent | ddea677b6730f9f72d94f87885e38cff6d329fab (diff) | |
download | history-870d3c0a86538c98d81849fa58d13f443d30ca2c.tar.gz |
[PATCH] sched_getaffinity vs cpu hotplug race fix
From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Fix the race in sys_sched_getaffinity. Patch below takes cpu_hotplug lock
before reading cpus_allowed mask of a task.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 059fc20851ea38..422bfeb614e1ee 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -2934,6 +2934,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, if (len < real_len) return -EINVAL; + lock_cpu_hotplug(); read_lock(&tasklist_lock); retval = -ESRCH; @@ -2946,6 +2947,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, out_unlock: read_unlock(&tasklist_lock); + unlock_cpu_hotplug(); if (retval) return retval; if (copy_to_user(user_mask_ptr, &mask, real_len)) |