Skip to content

Commit

Permalink
posix-timers: Fix clock_adjtime to always return timex data on success
Browse files Browse the repository at this point in the history
The clock_adj call returns the clock state on success, which may be a
non-zero value (e.g. TIME_INS), but the modified timex data is copied
back to the user only when zero value (TIME_OK) was returned. Fix the
condition to copy the data also with positive return values.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
Miroslav Lichvar authored and John Stultz committed Jan 16, 2013
1 parent 2353b47 commit f0dbe81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/posix-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ SYSCALL_DEFINE2(clock_adjtime, const clockid_t, which_clock,

err = kc->clock_adj(which_clock, &ktx);

if (!err && copy_to_user(utx, &ktx, sizeof(ktx)))
if (err >= 0 && copy_to_user(utx, &ktx, sizeof(ktx)))
return -EFAULT;

return err;
Expand Down

0 comments on commit f0dbe81

Please sign in to comment.