Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8986c24 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

[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: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cb3e0fe3
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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;
}