[PATCH] revert "Drop tasklist lock in do_sched_setscheduler"

sched_setscheduler() looks at ->signal->rlim[]. It is unsafe do
dereference ->signal unless tasklist_lock or ->siglock is held (or p ==
current). We pin the task structure, but this can't prevent from
release_task()->__exit_signal() which sets ->signal = NULL.

Restore tasklist_lock across the setscheduler call.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Oleg Nesterov and committed by Linus Torvalds f8986c24 cb3e0fe3

+1 -3
+1 -3
kernel/sched.c
··· 4162 4162 read_unlock_irq(&tasklist_lock); 4163 4163 return -ESRCH; 4164 4164 } 4165 - get_task_struct(p); 4166 - read_unlock_irq(&tasklist_lock); 4167 4165 retval = sched_setscheduler(p, policy, &lparam); 4168 - put_task_struct(p); 4166 + read_unlock_irq(&tasklist_lock); 4169 4167 4170 4168 return retval; 4171 4169 }