DragonFlyBSD Kernel Audit
DF-0039 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -310,9 +310,9 @@
 	 * pre-created if a non-unix 98 pty.  If si_drv1 is NULL
 	 * we are somehow racing a unix98 termination.
 	 */
-	if (dev->si_drv1 == NULL)
-		return(ENXIO);
 	pti = dev->si_drv1;
+	if (pti == NULL)
+		return(ENXIO);
 
 	lwkt_gettoken(&pti->pt_tty.t_token);
 	if (pti_hold(pti)) {