Commit 70118837 authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Linus Torvalds

kernel/sys.c: fix missing rcu protection for sys_getpriority()

find_task_by_vpid() is not safe without rcu_read_lock().  2.6.33-rc7 got
RCU protection for sys_setpriority() but missed it for sys_getpriority().
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5a2d4196
...@@ -222,6 +222,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who) ...@@ -222,6 +222,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
if (which > PRIO_USER || which < PRIO_PROCESS) if (which > PRIO_USER || which < PRIO_PROCESS)
return -EINVAL; return -EINVAL;
rcu_read_lock();
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
switch (which) { switch (which) {
case PRIO_PROCESS: case PRIO_PROCESS:
...@@ -267,6 +268,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who) ...@@ -267,6 +268,7 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
} }
out_unlock: out_unlock:
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
rcu_read_unlock();
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment