Commit 701188374b6f1ef9cf7e4dce4a2e69ef4c0012ac

Authored by Tetsuo Handa
Committed by Linus Torvalds
1 parent 5a2d41961d

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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

... ... @@ -222,6 +222,7 @@
222 222 if (which > PRIO_USER || which < PRIO_PROCESS)
223 223 return -EINVAL;
224 224  
  225 + rcu_read_lock();
225 226 read_lock(&tasklist_lock);
226 227 switch (which) {
227 228 case PRIO_PROCESS:
... ... @@ -267,6 +268,7 @@
267 268 }
268 269 out_unlock:
269 270 read_unlock(&tasklist_lock);
  271 + rcu_read_unlock();
270 272  
271 273 return retval;
272 274 }