summaryrefslogtreecommitdiff
path: root/sys/dev/sun
diff options
context:
space:
mode:
authortsutsui <tsutsui@NetBSD.org>2020-01-18 21:08:42 +0000
committertsutsui <tsutsui@NetBSD.org>2020-01-18 21:08:42 +0000
commite6b04a2d26e0aeef47419168c9d2d1357ff8fc2e (patch)
tree812a224d5e0f0ba1968cceb25ef2cb10cf294d3a /sys/dev/sun
parent0c4ecdae819fe5bef51678052940316c04c7d64e (diff)
Fix panic on sun3 when any key is typed when kbd is not console. PR/54873
Should be pulled up to netbsd-9.
Diffstat (limited to 'sys/dev/sun')
-rw-r--r--sys/dev/sun/kbd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c
index dcc14e19ac1..79740fd7cc1 100644
--- a/sys/dev/sun/kbd.c
+++ b/sys/dev/sun/kbd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kbd.c,v 1.70 2019/11/10 21:16:37 chs Exp $ */
+/* $NetBSD: kbd.c,v 1.71 2020/01/18 21:08:42 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.70 2019/11/10 21:16:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.71 2020/01/18 21:08:42 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -202,7 +202,7 @@ kbdopen(dev_t dev, int flags, int mode, struct lwp *l)
k->k_events.ev_io = l->l_proc;
/* stop pending autorepeat of console input */
- if (k->k_repeating) {
+ if (k->k_cc != NULL && k->k_repeating) {
k->k_repeating = 0;
callout_stop(&k->k_repeat_ch);
}
@@ -492,9 +492,11 @@ kbd_input(struct kbd_softc *k, int code)
/*
* If /dev/kbd is not connected in event mode, or wskbd mode,
- * translate and send upstream (to console).
+ * and is attached as console, translate and send upstream
+ * (to console).
*/
- kbd_input_console(k, code);
+ if (k->k_cc != NULL)
+ kbd_input_console(k, code);
}