--- a/sys/kern/tty_conf.c +++ b/sys/kern/tty_conf.c @@ -103,6 +103,11 @@ } } else if (discipline >= 0 && discipline < MAXLDISC) { + if (bcmp(linesw + discipline, &nodisc, sizeof(nodisc)) != 0) { + /* slot occupied: refuse instead of aliasing */ + lwkt_reltoken(&tty_token); + return (-1); + } slot = discipline; }