Index: sys/fs/procfs/procfs_ioctl.c =================================================================== RCS file: /home/ncvs/src/sys/fs/procfs/procfs_ioctl.c,v retrieving revision 1.16 diff -u -r1.16 procfs_ioctl.c --- sys/fs/procfs/procfs_ioctl.c 19 Feb 2007 13:04:25 -0000 1.16 +++ sys/fs/procfs/procfs_ioctl.c 1 May 2007 11:30:22 -0000 @@ -70,7 +70,10 @@ int ival; #endif - PROC_LOCK(p); + KASSERT(p != NULL, + ("%s() called without a process", __func__)); + PROC_LOCK_ASSERT(p, MA_OWNED); + error = 0; switch (cmd) { #if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) @@ -124,8 +127,10 @@ case PIOCWAIT: while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ + _PHOLD(p); error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); + _PRELE(p); if (error != 0) break; } @@ -142,8 +147,10 @@ case PIOCWAIT32: while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ + _PHOLD(p); error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); + _PRELE(p); if (error != 0) break; } @@ -193,7 +200,6 @@ default: error = (ENOTTY); } - PROC_UNLOCK(p); return (error); }