Module Name:    src
Committed By:   christos
Date:           Thu May 21 12:00:59 UTC 2015

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

Log Message:
Avoid dereferencing NULL tp crashing the kernel (brad harder)
XXX: pullup 7


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/dev/filemon/filemon.c:1.9
--- src/sys/dev/filemon/filemon.c:1.8	Fri Jul 25 04:10:36 2014
+++ src/sys/dev/filemon/filemon.c	Thu May 21 08:00:59 2015
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.8 2014/07/25 08:10:36 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.9 2015/05/21 12:00:59 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -307,12 +307,15 @@ filemon_ioctl(struct file * fp, u_long c
 		mutex_enter(proc_lock);
 		tp = proc_find(*((pid_t *) data));
 		mutex_exit(proc_lock);
+		if (tp == NULL) {
+			error = ESRCH;
+			break;
+		}
 		error = kauth_authorize_process(curproc->p_cred,
 		    KAUTH_PROCESS_CANSEE, tp,
 		    KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_ENTRY), NULL, NULL);
 		if (!error) {
 			filemon->fm_pid = tp->p_pid;
-
 		}
 		break;
 

Reply via email to