Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752797AbdFLTRD (ORCPT ); Mon, 12 Jun 2017 15:17:03 -0400 Received: from terminus.zytor.com ([65.50.211.136]:42105 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbdFLTRB (ORCPT ); Mon, 12 Jun 2017 15:17:01 -0400 Date: Mon, 12 Jun 2017 12:13:15 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, gorcunov@openvz.org, john.stultz@linaro.org, mingo@kernel.org, tglx@linutronix.de, avagin@virtuozzo.com, peterz@infradead.org Reply-To: john.stultz@linaro.org, gorcunov@openvz.org, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, avagin@virtuozzo.com, tglx@linutronix.de, mingo@kernel.org In-Reply-To: <20170609201156.GB21491@outlook.office365.com> References: <20170609201156.GB21491@outlook.office365.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] posix-timers: Zero out oldval itimerspec Git-Commit-ID: 5c7a3a3d20a4e175304c0e23809e3d70be8fed8a 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 Content-Length: 1584 Lines: 40 Commit-ID: 5c7a3a3d20a4e175304c0e23809e3d70be8fed8a Gitweb: http://git.kernel.org/tip/5c7a3a3d20a4e175304c0e23809e3d70be8fed8a Author: Thomas Gleixner AuthorDate: Mon, 12 Jun 2017 19:44:09 +0200 Committer: Thomas Gleixner CommitDate: Mon, 12 Jun 2017 21:07:40 +0200 posix-timers: Zero out oldval itimerspec The recent posix timer rework moved the clearing of the itimerspec to the real syscall implementation, but forgot that the kclock->timer_get() is used by timer_settime() as well. That results in an uninitialized variable and bogus values returned to user space. Add the missing memset to timer_settime(). Fixes: eabdec043853 ("posix-timers: Zero settings value in common code") Reported-by: Andrei Vagin Signed-off-by: Thomas Gleixner Cc: Peter Zijlstra Cc: John Stultz Cc: Cyrill Gorcunov Link: http://lkml.kernel.org/r/20170609201156.GB21491@outlook.office365.com --- kernel/time/posix-timers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index b53a0b5..88517dc 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -828,6 +828,8 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, if (!timespec64_valid(&new_spec64.it_interval) || !timespec64_valid(&new_spec64.it_value)) return -EINVAL; + if (rtn) + memset(rtn, 0, sizeof(*rtn)); retry: timr = lock_timer(timer_id, &flag); if (!timr)