From: Sasha Levin <sasha.levin@oracle.com>
To: john.stultz@linaro.org, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow
Date: Thu, 3 Dec 2015 22:09:31 -0500 [thread overview]
Message-ID: <1449198571-21133-1-git-send-email-sasha.levin@oracle.com> (raw)
Make sure the tv_usec makes sense. We might multiply them later which can
cause an overflow and undefined behavior.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
kernel/time/timekeeping.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d563c19..aa3c1c2 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1987,6 +1987,10 @@ int do_adjtimex(struct timex *txc)
if (txc->modes & ADJ_SETOFFSET) {
struct timespec delta;
+
+ if (txc->time.tv_usec >= USEC_PER_SEC || txc->time.tv_usec <= -USEC_PER_SEC)
+ return -EINVAL;
+
delta.tv_sec = txc->time.tv_sec;
delta.tv_nsec = txc->time.tv_usec;
if (!(txc->modes & ADJ_NANO))
--
1.7.10.4
next reply other threads:[~2015-12-04 3:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 3:09 Sasha Levin [this message]
2015-12-04 20:27 ` John Stultz
2015-12-05 17:10 ` Thomas Gleixner
2015-12-06 0:15 ` Sasha Levin
2015-12-06 9:07 ` Thomas Gleixner
2015-12-06 22:11 ` Richard Cochran
2015-12-07 19:54 ` John Stultz
2015-12-07 20:11 ` [RFC][PATCH -reworked] time: Verify " John Stultz
2015-12-07 20:13 ` John Stultz
2015-12-07 20:16 ` Thomas Gleixner
2015-12-07 20:15 ` [PATCH] time: verify " Thomas Gleixner
2015-12-07 20:19 ` John Stultz
2015-12-07 20:23 ` John Stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449198571-21133-1-git-send-email-sasha.levin@oracle.com \
--to=sasha.levin@oracle.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®