shmdt when no mapping is ok, found by christos
authorderaadt <deraadt@openbsd.org>
Mon, 2 Sep 1996 05:25:06 +0000 (05:25 +0000)
committerderaadt <deraadt@openbsd.org>
Mon, 2 Sep 1996 05:25:06 +0000 (05:25 +0000)
sys/kern/sysv_shm.c

index ae4cae3..f31f05f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sysv_shm.c,v 1.4 1996/04/21 22:27:26 deraadt Exp $    */
+/*     $OpenBSD: sysv_shm.c,v 1.5 1996/09/02 05:25:06 deraadt Exp $    */
 /*     $NetBSD: sysv_shm.c,v 1.37 1996/03/16 23:17:13 christos Exp $   */
 
 /*
@@ -178,6 +178,8 @@ sys_shmdt(p, v, retval)
        int i;
 
        shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm;
+       if (shmmap_s == NULL)
+               return EINVAL;
        for (i = 0; i < shminfo.shmseg; i++, shmmap_s++)
                if (shmmap_s->shmid != -1 &&
                    shmmap_s->va == (vm_offset_t)SCARG(uap, shmaddr))