Re: [PATCH] time, ntp: Do not update time_state in middle of leap

From: Miroslav Lichvar
Date: Wed Feb 04 2015 - 11:30:13 EST


Prarit Bhargava wrote:
> While this is highly unlikely to ever happen in the real world it is
> still something we should protect against, as breaking the state machine
> is obviously bad.

I'm not sure what exactly breaks here. If the PLL is disabled before
time_state is set to TIME_OOP, the insertion/deletion will be aborted.
If after that, adjtimex() will return with TIME_ERROR as expected, or
not?

> static inline void process_adj_status(struct timex *txc, struct timespec64 *ts)
> {
> - if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {
> + if ((time_status & STA_PLL) && !(txc->status & STA_PLL) &&
> + (time_state != TIME_OOP)) {
> time_state = TIME_OK;
> time_status = STA_UNSYNC;
> /* restart PPS frequency calibration */

Shouldn't be time_status reset and the PPS calibration restarted even
when state is TIME_OOP?

--
Miroslav Lichvar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/