Add endpoint checks in scheduling kernel calls

This commit is contained in:
Erik van der Kouwe 2010-06-08 12:04:21 +00:00
parent 49165ef796
commit 78186ee5f5
2 changed files with 9 additions and 1 deletions

View file

@ -9,12 +9,16 @@
PUBLIC int do_schedctl(struct proc * caller, message * m_ptr)
{
struct proc *p;
int proc_nr;
/* Only system processes can change process schedulers */
if (! (priv(caller)->s_flags & SYS_PROC))
return(EPERM);
p = proc_addr(_ENDPOINT_P(m_ptr->SCHEDULING_ENDPOINT));
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
return EINVAL;
p = proc_addr(proc_nr);
p->p_scheduler = caller;
return(OK);

View file

@ -10,6 +10,10 @@
PUBLIC int do_schedule(struct proc * caller, message * m_ptr)
{
struct proc *p;
int proc_nr;
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
return EINVAL;
p = proc_addr(_ENDPOINT_P(m_ptr->SCHEDULING_ENDPOINT));