Module Name:    src
Committed By:   tsutsui
Date:           Wed Feb 19 11:40:31 UTC 2014

Modified Files:
        src/sys/arch/atari/dev: ite.c

Log Message:
Fix kernel crash when a user tries to switch to nonexistent terminal.

Reported by Gabor Sebestyen in PR port-atari/48599.

Should be pulled up to all netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/atari/dev/ite.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/arch/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.71 src/sys/arch/atari/dev/ite.c:1.72
--- src/sys/arch/atari/dev/ite.c:1.71	Sun Jun  5 16:25:12 2011
+++ src/sys/arch/atari/dev/ite.c	Wed Feb 19 11:40:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.72 2014/02/19 11:40:31 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.72 2014/02/19 11:40:31 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -665,8 +665,8 @@ ite_switch(int unit)
 	struct ite_softc	*sc;
 	extern const struct cdevsw view_cdevsw;
 
-	sc = getitesp(unit);
-	if ((sc->flags & (ITE_ATTACHED | ITE_INITED)) == 0)
+	sc = device_lookup_private(&ite_cd, unit);
+	if (sc == NULL || (sc->flags & (ITE_ATTACHED | ITE_INITED)) == 0)
 		return;
 
 	/*

Reply via email to