]> Zhao Yanbai Git Server - minix.git/commitdiff
Add endpoint checks in scheduling kernel calls
authorErik van der Kouwe <erik@minix3.org>
Tue, 8 Jun 2010 12:04:21 +0000 (12:04 +0000)
committerErik van der Kouwe <erik@minix3.org>
Tue, 8 Jun 2010 12:04:21 +0000 (12:04 +0000)
kernel/system/do_schedctl.c
kernel/system/do_schedule.c

index 592b7d4f245a002b2c61e1c6a0afc961a4a360fd..a4ae1655fbb48059d8baa7a85db9a8dd4cf4ba90 100644 (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);
index 04470767337d18075041f01bdfda272e02005f2d..bf68c43daa2d4fcb594c9c00c25d259aead1a3e8 100644 (file)
 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));