Sanity checks prevent VM panic for mmap, vm_remap and map_phys

This commit is contained in:
Erik van der Kouwe 2011-07-19 08:58:01 +02:00
parent c356e9997e
commit b1408f61b4

View file

@ -55,7 +55,7 @@ PUBLIC int do_mmap(message *m)
u32_t vrflags = VR_ANON | VR_WRITABLE;
size_t len = (vir_bytes) m->VMM_LEN;
if(m->VMM_FD != -1) {
if(m->VMM_FD != -1 || len <= 0) {
return EINVAL;
}
@ -143,6 +143,8 @@ PUBLIC int do_map_phys(message *m)
target = m->VMMP_EP;
len = m->VMMP_LEN;
if (len <= 0) return EINVAL;
if(target == SELF)
target = m->m_source;
@ -234,6 +236,8 @@ PUBLIC int do_remap(message *m)
sa = (vir_bytes) m->VMRE_SA;
size = m->VMRE_SIZE;
if (size <= 0) return EINVAL;
if ((r = vm_isokendpt((endpoint_t) m->VMRE_D, &dn)) != OK)
return EINVAL;
if ((r = vm_isokendpt((endpoint_t) m->VMRE_S, &sn)) != OK)