kernel -- Resolve NULL ptr dereference in fill_kinfo_proc.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Fri, 7 Oct 2011 19:45:03 +0000 (12:45 -0700)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Fri, 7 Oct 2011 19:45:03 +0000 (12:45 -0700)
Reported-by: Justin Sherrill
sys/kern/kern_kinfo.c

index 9c5c03d..65fbf48 100644 (file)
@@ -124,7 +124,7 @@ fill_kinfo_proc(struct proc *p, struct kinfo_proc *kp)
                bcopy(sess->s_login, kp->kp_login, MAXLOGNAME);
                if (sess->s_ttyvp != NULL)
                        kp->kp_auxflags |= KI_CTTY;
-               if (SESS_LEADER(p))
+               if ((p->p_session != NULL) && SESS_LEADER(p))
                        kp->kp_auxflags |= KI_SLEADER;
        }
        if (sess && (p->p_flag & P_CONTROLT) != 0 && sess->s_ttyp != NULL) {