aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-08-27 01:23:34 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-08-27 11:01:29 -0700
commitf8986c241dfd54d51c9eff967129a550ae230144 (patch)
tree62f9a9739a2119024ad7bef7c26498bd332904b5
parentcb3e0fe3a5dabdc5eda50b825acb23bdfa2d1d55 (diff)
downloadlinux-yocto-4.8-f8986c241dfd54d51c9eff967129a550ae230144.tar.gz
linux-yocto-4.8-f8986c241dfd54d51c9eff967129a550ae230144.tar.bz2
linux-yocto-4.8-f8986c241dfd54d51c9eff967129a550ae230144.zip
[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>
-rw-r--r--kernel/sched.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index a2be2d055299..a234fbee1238 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4162,10 +4162,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
read_unlock_irq(&tasklist_lock);
return -ESRCH;
}
- get_task_struct(p);
- read_unlock_irq(&tasklist_lock);
retval = sched_setscheduler(p, policy, &lparam);
- put_task_struct(p);
+ read_unlock_irq(&tasklist_lock);
return retval;
}