Module Name:    src
Committed By:   pgoyette
Date:           Fri Jan  8 08:57:14 UTC 2016

Modified Files:
        src/sys/dev/filemon: filemon.c

Log Message:
Don't release the proc_lock mutex until we're finished using the stuff
that the mutex protects (ie, the proc list and the entry we found in
the list).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.25 src/sys/dev/filemon/filemon.c:1.26
--- src/sys/dev/filemon/filemon.c:1.25	Fri Jan  8 07:16:13 2016
+++ src/sys/dev/filemon/filemon.c	Fri Jan  8 08:57:14 2016
@@ -1,4 +1,4 @@
-/*      $NetBSD: filemon.c,v 1.25 2016/01/08 07:16:13 dholland Exp $ */
+/*      $NetBSD: filemon.c,v 1.26 2016/01/08 08:57:14 pgoyette Exp $ */
 /*
  * Copyright (c) 2010, Juniper Networks, Inc.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.25 2016/01/08 07:16:13 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.26 2016/01/08 08:57:14 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -317,10 +317,10 @@ filemon_ioctl(struct file * fp, u_long c
 		/* Set the monitored process ID - if allowed. */
 		mutex_enter(proc_lock);
 		tp = proc_find(*((pid_t *) data));
-		mutex_exit(proc_lock);
 		if (tp == NULL ||
 		    tp->p_emul != &emul_netbsd) {
 			error = ESRCH;
+			mutex_exit(proc_lock);
 			break;
 		}
 
@@ -330,6 +330,7 @@ filemon_ioctl(struct file * fp, u_long c
 		if (!error) {
 			filemon->fm_pid = tp->p_pid;
 		}
+		mutex_exit(proc_lock);
 		break;
 
 	default:

Reply via email to