[LinuxPPS] Bug in LinuxPPS startup

David djch-pps at whabbit.demon.co.uk
Wed Oct 29 02:37:19 CET 2008


Rodolfo Giometti wrote:
> 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
>
>   
Rodolfo,

Have just recompiled, and I restarted pps_ldisc a couple of times - no
crash. Clearly needs more testing, but
I think you've fixed it.

 (I got  PPS_FETCH: source 0
timeout 0.000000000

when I tried to restart ppsldisc, but I've just unloaded and reloaded
pps_ldisc in the kernel, restarted ppsldisc and ntpd, and ntpd has
locked to the pps. )

--David




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ml.enneenne.com/pipermail/linuxpps/attachments/20081029/1d71a258/attachment.htm 


More information about the LinuxPPS mailing list