]>
Commit | Line | Data |
---|---|---|
6e4ffbcf SL |
1 | From d083639da32af03050e6c28a0f4212b89c038cef Mon Sep 17 00:00:00 2001 |
2 | From: Miroslav Lichvar <mlichvar@redhat.com> | |
3 | Date: Wed, 17 Apr 2019 10:48:33 +0200 | |
4 | Subject: ntp: Allow TAI-UTC offset to be set to zero | |
5 | ||
6 | [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] | |
7 | ||
8 | The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. | |
9 | It is typically set by NTP/PTP implementations and it is automatically | |
10 | updated by the kernel on leap seconds. The initial value is zero (which | |
11 | applications may interpret as unknown), but this value cannot be set by | |
12 | adjtimex. This limitation seems to go back to the original "nanokernel" | |
13 | implementation by David Mills. | |
14 | ||
15 | Change the ADJ_TAI check to accept zero as a valid TAI-UTC offset in | |
16 | order to allow setting it back to the initial value. | |
17 | ||
18 | Fixes: 153b5d054ac2 ("ntp: support for TAI") | |
19 | Suggested-by: Ondrej Mosnacek <omosnace@redhat.com> | |
20 | Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> | |
21 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
22 | Cc: John Stultz <john.stultz@linaro.org> | |
23 | Cc: Richard Cochran <richardcochran@gmail.com> | |
24 | Cc: Prarit Bhargava <prarit@redhat.com> | |
25 | Link: https://lkml.kernel.org/r/20190417084833.7401-1-mlichvar@redhat.com | |
26 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
27 | --- | |
28 | kernel/time/ntp.c | 2 +- | |
29 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
30 | ||
31 | diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c | |
32 | index 99e03bec68e4..4bb9b66338be 100644 | |
33 | --- a/kernel/time/ntp.c | |
34 | +++ b/kernel/time/ntp.c | |
35 | @@ -640,7 +640,7 @@ static inline void process_adjtimex_modes(struct timex *txc, | |
36 | time_constant = max(time_constant, 0l); | |
37 | } | |
38 | ||
39 | - if (txc->modes & ADJ_TAI && txc->constant > 0) | |
40 | + if (txc->modes & ADJ_TAI && txc->constant >= 0) | |
41 | *time_tai = txc->constant; | |
42 | ||
43 | if (txc->modes & ADJ_OFFSET) | |
44 | -- | |
45 | 2.20.1 | |
46 |