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