From 7681e91720563c3046df47d3fe585be3e441409a Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 9 Feb 2015 03:19:47 -0500 Subject: Linux v3.19 --- ...adjtimex-freq-validation-on-32bit-systems.patch | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch (limited to 'ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch') 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 +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 +Reported-by: Josh Boyer +Reported-by: George Joseph +Signed-off-by: John Stultz +--- + 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 + -- cgit