All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for John Stultz <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: prarit@redhat.com, arnd@arndb.de, john.stultz@linaro.org,
	hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org,
	shuahkh@osg.samsung.com, mika.westerberg@linux.intel.com,
	linux-kernel@vger.kernel.org, richardcochran@gmail.com,
	baolin.wang@linaro.org
Subject: [tip:timers/urgent] time: Make settimeofday error checking work again
Date: Wed, 1 Jun 2016 12:19:50 -0700	[thread overview]
Message-ID: <tip-dfc2507b26af22b0bbc85251b8545b36d8bc5d72@git.kernel.org> (raw)
In-Reply-To: <1464807207-16530-2-git-send-email-john.stultz@linaro.org>

Commit-ID:  dfc2507b26af22b0bbc85251b8545b36d8bc5d72
Gitweb:     http://git.kernel.org/tip/dfc2507b26af22b0bbc85251b8545b36d8bc5d72
Author:     John Stultz <john.stultz@linaro.org>
AuthorDate: Wed, 1 Jun 2016 11:53:26 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 1 Jun 2016 21:13:43 +0200

time: Make settimeofday error checking work again

In commit 86d3473224b0 some of the checking for a valid timeval
was subtley changed which caused -EINVAL to be returned whenever
the timeval was null.

However, it is possible to set the timezone data while specifying
a NULL timeval, which is usually done to handle systems where the
RTC keeps local time instead of UTC. Thus the patch causes such
systems to have the time incorrectly set.

This patch addresses the issue by handling the error conditionals
in the same way as was done previously.

Fixes: 86d3473224b0 "time: Introduce do_sys_settimeofday64()"
Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Baolin Wang <baolin.wang@linaro.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Link: http://lkml.kernel.org/r/1464807207-16530-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/timekeeping.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 37dbacf..816b754 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -21,6 +21,9 @@ static inline int do_sys_settimeofday(const struct timespec *tv,
 	struct timespec64 ts64;
 
 	if (!tv)
+		return do_sys_settimeofday64(NULL, tz);
+
+	if (!timespec_valid(tv))
 		return -EINVAL;
 
 	ts64 = timespec_to_timespec64(*tv);

  reply	other threads:[~2016-06-01 19:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 18:53 [PATCH 0/2 v2] Fix for settimeofday() error checking regression John Stultz
2016-06-01 18:53 ` [PATCH 1/2 v2] time: Fix problematic change in settimeofday error checking John Stultz
2016-06-01 19:19   ` tip-bot for John Stultz [this message]
2016-06-01 18:53 ` [PATCH 2/2] kselftests: timers: Add set-tz test case John Stultz
2016-06-02 22:43   ` Shuah Khan

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=tip-dfc2507b26af22b0bbc85251b8545b36d8bc5d72@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=arnd@arndb.de \
    --cc=baolin.wang@linaro.org \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mingo@kernel.org \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=shuahkh@osg.samsung.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.