From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751468AbcFATUS (ORCPT ); Wed, 1 Jun 2016 15:20:18 -0400 Received: from terminus.zytor.com ([198.137.202.10]:45526 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751099AbcFATUQ (ORCPT ); Wed, 1 Jun 2016 15:20:16 -0400 Date: Wed, 1 Jun 2016 12:19:50 -0700 From: tip-bot for John Stultz Message-ID: 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 Reply-To: arnd@arndb.de, prarit@redhat.com, richardcochran@gmail.com, baolin.wang@linaro.org, tglx@linutronix.de, hpa@zytor.com, john.stultz@linaro.org, shuahkh@osg.samsung.com, mingo@kernel.org, mika.westerberg@linux.intel.com, linux-kernel@vger.kernel.org In-Reply-To: <1464807207-16530-2-git-send-email-john.stultz@linaro.org> References: <1464807207-16530-2-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] time: Make settimeofday error checking work again Git-Commit-ID: dfc2507b26af22b0bbc85251b8545b36d8bc5d72 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: dfc2507b26af22b0bbc85251b8545b36d8bc5d72 Gitweb: http://git.kernel.org/tip/dfc2507b26af22b0bbc85251b8545b36d8bc5d72 Author: John Stultz AuthorDate: Wed, 1 Jun 2016 11:53:26 -0700 Committer: Thomas Gleixner 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 Signed-off-by: John Stultz Tested-by: Mika Westerberg Cc: Prarit Bhargava Cc: Arnd Bergmann Cc: Baolin Wang Cc: Richard Cochran Cc: Shuah Khan Link: http://lkml.kernel.org/r/1464807207-16530-2-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner --- 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);