Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/filemon Avoid dereferencing NULL tp crashing the ker...



details:   https://anonhg.NetBSD.org/src/rev/28e626a37f3f
branches:  trunk
changeset: 338397:28e626a37f3f
user:      christos <christos%NetBSD.org@localhost>
date:      Thu May 21 12:00:59 2015 +0000

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

diffstat:

 sys/dev/filemon/filemon.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 038e60debc3a -r 28e626a37f3f sys/dev/filemon/filemon.c
--- a/sys/dev/filemon/filemon.c Thu May 21 10:35:08 2015 +0000
+++ b/sys/dev/filemon/filemon.c Thu May 21 12:00:59 2015 +0000
@@ -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 @@
                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;
 



Home | Main Index | Thread Index | Old Index