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.
This commit is contained in:
tsutsui 2014-02-19 11:40:31 +00:00
parent 4893e5b805
commit 7e3311382f
1 changed files with 4 additions and 4 deletions

View File

@ -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;
/*