summaryrefslogtreecommitdiff
path: root/sys/dev/wscons
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2018-12-17 19:15:00 +0000
committeranton <anton@cvs.openbsd.org>2018-12-17 19:15:00 +0000
commit861663a13a220494517f171afcd797767b3d5477 (patch)
tree36f688f0fce988f73b6dc77a14e27341a18d8664 /sys/dev/wscons
parent9c28878c4a41ff463fc86fca534c1d7473360b79 (diff)
When no child devices are attached to a wsmux device, make sure to return an
error for inappropriate ioctl commands. Prevents a panic caused by using a wsmux device as the controlling terminal. ok deraadt@ visa@ Reported-by: syzbot+44bab40fc5a11357d774@syzkaller.appspotmail.com
Diffstat (limited to 'sys/dev/wscons')
-rw-r--r--sys/dev/wscons/wsmux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index b85495c605b..f92cf46d38d 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.35 2018/11/20 19:33:44 anton Exp $ */
+/* $OpenBSD: wsmux.c,v 1.36 2018/12/17 19:14:59 anton Exp $ */
/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -497,8 +497,11 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
)
return (EACCES);
- /* Return 0 if any of the ioctl() succeeds, otherwise the last error */
- error = 0;
+ /*
+ * If children are attached: return 0 if any of the ioctl() succeeds,
+ * otherwise the last error.
+ */
+ error = ENOTTY;
ok = 0;
TAILQ_FOREACH(me, &sc->sc_cld, me_next) {
#ifdef DIAGNOSTIC