posix-timers: Zero out oldval itimerspec
authorThomas Gleixner <[email protected]>
Mon, 12 Jun 2017 17:44:09 +0000 (19:44 +0200)
committerThomas Gleixner <[email protected]>
Mon, 12 Jun 2017 19:07:40 +0000 (21:07 +0200)
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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Cyrill Gorcunov <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
kernel/time/posix-timers.c

index b53a0b5625161327aaf7bff9e06c88ea2521d436..88517dcfe0ca249575411935a97e48e730723061 100644 (file)
@@ -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)