[LinuxPPS] Bug in LinuxPPS startup
Rodolfo Giometti
giometti at enneenne.com
Tue Oct 28 12:12:53 CET 2008
On Mon, Oct 27, 2008 at 11:07:03PM +0000, David wrote:
>
> The kernel crashes in uart_handle_dcd_change() (inlined into
> check_modem_status()), in the fourth line
>
> if (ld->ops->dcd_change)
>
> I believe ld is returning 0 from tty_ldisc_ref().
This could be true... a possible patch should be:
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f4cfc66..7cb6b9b 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -492,7 +492,7 @@ uart_handle_dcd_change(struct uart_port *port,
unsigned int
struct tty_ldisc *ld = tty_ldisc_ref(info->port.tty);
struct timespec ts;
- if (ld->ops->dcd_change)
+ if (ld && ld->ops->dcd_change)
#ifdef CONFIG_PPS_IRQ_EVENTS
ts = pps_irq_ts[port->irq];
#else
@@ -512,9 +512,10 @@ uart_handle_dcd_change(struct uart_port *port,
unsigned int
tty_hangup(info->port.tty);
}
- if (ld->ops->dcd_change)
+ if (ld && ld->ops->dcd_change)
ld->ops->dcd_change(info->port.tty, status, &ts);
- tty_ldisc_deref(ld);
+ if (ld)
+ tty_ldisc_deref(ld);
}
/**
Can you please test it?
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
More information about the LinuxPPS
mailing list