Don't forget to check invalid policy!

This commit is contained in:
David Xu 2006-07-11 08:19:57 +00:00
parent 006faeb831
commit 2dca4ca723
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160259

View File

@ -128,18 +128,20 @@ create_thread(struct thread *td, mcontext_t *ctx,
return (EPROCLIM);
if (sched != NULL) {
/* Only root can set scheduler policy */
if (sched->policy != SCHED_OTHER) {
switch(sched->policy) {
case SCHED_FIFO:
case SCHED_RR:
/* Only root can set scheduler policy */
if (suser(td) != 0)
return (EPERM);
if (sched->policy != SCHED_FIFO &&
sched->policy != SCHED_RR)
return (EINVAL);
if (sched->param.sched_priority < RTP_PRIO_MIN ||
sched->param.sched_priority > RTP_PRIO_MAX)
return (EINVAL);
break;
case SCHED_OTHER:
break;
default:
return (EINVAL);
}
}