Messages in this thread | | | Date | Fri, 25 May 2012 00:09:34 +0100 | From | Alan Cox <> | Subject | Re: kernel BUG and freeze on cat /proc/tty/driver/serial |
| |
> - struct tty_ldisc *ld = tty_ldisc_ref(port->tty); > + struct tty_ldisc *ld = port ? tty_ldisc_ref(port->tty) : NULL; > struct pps_event_time ts; > > if (ld && ld->ops->dcd_change) > @@ -2465,7 +2465,7 @@ void uart_handle_dcd_change(struct uart_port > *uport, unsigned int status) > hardpps(); > #endif > > - if (port->flags & ASYNC_CHECK_CD) { > + if (port && port->flags & ASYNC_CHECK_CD) { > if (status) > wake_up_interruptible(&port->open_wait); > else if (port->tty)
Probably should be using tty krefs for this
tty = tty_port_tty_get( ..) / tty_kref_put
etc, and yes the NULL check is needed. The reference is needed so the tty can't be freed under you.
| |