kernel/ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch
Josh Boyer 1ef071e4db Linux v3.19-463-g3e8c04eb1174
- Reenable debugging options.
- Temporarily disable aarch64 patches
2015-02-11 09:17:16 -05:00

46 lines
1.4 KiB
Diff

From: John Stultz <john.stultz@linaro.org>
Date: Mon, 2 Feb 2015 10:57:56 -0800
Subject: [PATCH] ntp: Fixup adjtimex freq validation on 32bit systems
Additional validation of adjtimex freq values to avoid
potential multiplication overflows were added in commit
5e5aeb4367b (time: adjtimex: Validate the ADJ_FREQUENCY values)
Unfortunately the patch used LONG_MAX/MIN instead of
LLONG_MAX/MIN, which was fine on 64bit systems, but caused
false positives on 32bit systems resulting in most direct
frequency adjustments to fail w/ EINVAL.
ntpd only does driect frequency adjustments at startup,
so the issue was not easily observed there, but other sync
applications like ptpd and chrony were more effected by
the bug.
Cc: Sasha Levin <sasha.levin@oracle.com>
Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
Reported-by: George Joseph <george.joseph@fairview5.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
kernel/time/ntp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 4b585e0fdd22..a5f4d24c95cc 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -634,9 +634,9 @@ int ntp_validate_timex(struct timex *txc)
return -EPERM;
if (txc->modes & ADJ_FREQUENCY) {
- if (LONG_MIN / PPM_SCALE > txc->freq)
+ if (LLONG_MIN / PPM_SCALE > txc->freq)
return -EINVAL;
- if (LONG_MAX / PPM_SCALE < txc->freq)
+ if (LLONG_MAX / PPM_SCALE < txc->freq)
return -EINVAL;
}
--
2.1.0