summaryrefslogtreecommitdiffstats
path: root/ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@fedoraproject.org>2015-02-09 03:19:47 -0500
committerJosh Boyer <jwboyer@fedoraproject.org>2015-02-09 03:19:47 -0500
commit7681e91720563c3046df47d3fe585be3e441409a (patch)
treee5847e50cf9273105ab801abee6c2808ba9d65f6 /ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch
parentc5c9c7b16e08a1e8d81cde2e5f79dc7b851068c2 (diff)
downloadkernel-7681e91720563c3046df47d3fe585be3e441409a.tar.gz
kernel-7681e91720563c3046df47d3fe585be3e441409a.tar.xz
kernel-7681e91720563c3046df47d3fe585be3e441409a.zip
Linux v3.19
Diffstat (limited to 'ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch')
-rw-r--r--ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch b/ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch
new file mode 100644
index 000000000..c8642654f
--- /dev/null
+++ b/ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch
@@ -0,0 +1,45 @@
+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 28bf91c60a0b..242774dd27a1 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
+