diff options
author | avatar <avatar@FreeBSD.org> | 2005-04-13 13:56:17 +0000 |
---|---|---|
committer | avatar <avatar@FreeBSD.org> | 2005-04-13 13:56:17 +0000 |
commit | e496403c65653d3ca697e465754440893ef2fd75 (patch) | |
tree | 688f751ba0e9cbacabecc36328711d80d96d202e /sys/kern | |
parent | db5f8a5b7b8a9274209304aff82f7656102e2034 (diff) | |
download | FreeBSD-src-e496403c65653d3ca697e465754440893ef2fd75.zip FreeBSD-src-e496403c65653d3ca697e465754440893ef2fd75.tar.gz |
According to the comment in struct tty, t_modem is optional; hence we should
guard against NULL t_modem entry. Otherwise, driver doesn't have t_modem
callback implemented(such like sys/dev/usb/ucycom.c) would panic when
someone opens the driver's associated tty device.
Reviewed by: phk, sam (mentor)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/tty.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 3eb9a23..8a6585b 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -3134,7 +3134,8 @@ open_top: */ tp->t_termios = ISCALLOUT(dev) ? tp->t_init_out : tp->t_init_in; tp->t_cflag = tp->t_termios.c_cflag; - tp->t_modem(tp, SER_DTR | SER_RTS, 0); + if (tp->t_modem != NULL) + tp->t_modem(tp, SER_DTR | SER_RTS, 0); ++tp->t_wopeners; error = tp->t_param(tp, &tp->t_termios); --tp->t_wopeners; @@ -3142,7 +3143,8 @@ open_top: error = tp->t_open(tp, dev); if (error != 0) goto out; - if (ISCALLOUT(dev) || (tp->t_modem(tp, 0, 0) & SER_DCD)) + if (ISCALLOUT(dev) || (tp->t_modem != NULL && + (tp->t_modem(tp, 0, 0) & SER_DCD))) ttyld_modem(tp, 1); } /* |