From: Erik van der Kouwe Date: Tue, 8 Jun 2010 12:04:21 +0000 (+0000) Subject: Add endpoint checks in scheduling kernel calls X-Git-Tag: v3.1.8~490 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/zones/static/man.host.html?a=commitdiff_plain;h=78186ee5f55375cf8621a36e6a83ee1ff79bf641;p=minix.git Add endpoint checks in scheduling kernel calls --- diff --git a/kernel/system/do_schedctl.c b/kernel/system/do_schedctl.c index 592b7d4f2..a4ae1655f 100644 --- a/kernel/system/do_schedctl.c +++ b/kernel/system/do_schedctl.c @@ -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); diff --git a/kernel/system/do_schedule.c b/kernel/system/do_schedule.c index 044707673..bf68c43da 100644 --- a/kernel/system/do_schedule.c +++ b/kernel/system/do_schedule.c @@ -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));