summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-01-24 15:37:48 +0000
committerkib <kib@FreeBSD.org>2008-01-24 15:37:48 +0000
commit17d99001fab69e948489158a3aa6caf948b0b996 (patch)
tree045cb9d9e9e3618b4e3f5b44d381c0cd58069189 /sys/dev/syscons
parent0db277677c2132cd54d285e84ef1e6c4744997cc (diff)
downloadFreeBSD-src-17d99001fab69e948489158a3aa6caf948b0b996.zip
FreeBSD-src-17d99001fab69e948489158a3aa6caf948b0b996.tar.gz
Do not dereference NULL scp in the case the screen is not opened.
Instead, return ENXIO to the ioctl caller. Reported and tested by: Pawel Worach <pawel.worach gmail com> Discussed with: markus MFC after: 3 days
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/syscons.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 152e51f..677ab57 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -1071,6 +1071,8 @@ scioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if (error)
return error;
scp = sc_get_stat(SC_DEV(sc, i));
+ if (scp == NULL)
+ return (ENXIO);
if (scp == scp->sc->cur_scp)
return 0;
error = tsleep(&scp->smode, PZERO | PCATCH, "waitvt", 0);
OpenPOWER on IntegriCloud