diff options
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index f5b7d91..4701584 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -3067,6 +3067,12 @@ ttyopen(struct cdev *dev, int flag, int mode, struct thread *td) struct tty *tp; tp = dev->si_tty; + + /* XXX It can happen that devfs_open calls us with tp->t_refcnt == 0 */ + if (tp == NULL || tp->t_refcnt == 0) { + return (ENXIO); + } + s = spltty(); /* * We jump to this label after all non-interrupted sleeps to pick |