|
@@ -117,8 +117,7 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
|
|
const struct timespec __user *, rqtp,
|
|
const struct timespec __user *, rqtp,
|
|
struct timespec __user *, rmtp)
|
|
struct timespec __user *, rmtp)
|
|
{
|
|
{
|
|
- struct timespec64 t64;
|
|
|
|
- struct timespec t;
|
|
|
|
|
|
+ struct timespec64 t;
|
|
|
|
|
|
switch (which_clock) {
|
|
switch (which_clock) {
|
|
case CLOCK_REALTIME:
|
|
case CLOCK_REALTIME:
|
|
@@ -129,16 +128,15 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (copy_from_user(&t, rqtp, sizeof (struct timespec)))
|
|
|
|
|
|
+ if (get_timespec64(&t, rqtp))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
- t64 = timespec_to_timespec64(t);
|
|
|
|
- if (!timespec64_valid(&t64))
|
|
|
|
|
|
+ if (!timespec64_valid(&t))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
if (flags & TIMER_ABSTIME)
|
|
if (flags & TIMER_ABSTIME)
|
|
rmtp = NULL;
|
|
rmtp = NULL;
|
|
current->restart_block.nanosleep.type = rmtp ? TT_NATIVE : TT_NONE;
|
|
current->restart_block.nanosleep.type = rmtp ? TT_NATIVE : TT_NONE;
|
|
current->restart_block.nanosleep.rmtp = rmtp;
|
|
current->restart_block.nanosleep.rmtp = rmtp;
|
|
- return hrtimer_nanosleep(&t64, flags & TIMER_ABSTIME ?
|
|
|
|
|
|
+ return hrtimer_nanosleep(&t, flags & TIMER_ABSTIME ?
|
|
HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
|
|
HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
|
|
which_clock);
|
|
which_clock);
|
|
}
|
|
}
|
|
@@ -203,8 +201,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
|
|
struct compat_timespec __user *, rqtp,
|
|
struct compat_timespec __user *, rqtp,
|
|
struct compat_timespec __user *, rmtp)
|
|
struct compat_timespec __user *, rmtp)
|
|
{
|
|
{
|
|
- struct timespec64 t64;
|
|
|
|
- struct timespec t;
|
|
|
|
|
|
+ struct timespec64 t;
|
|
|
|
|
|
switch (which_clock) {
|
|
switch (which_clock) {
|
|
case CLOCK_REALTIME:
|
|
case CLOCK_REALTIME:
|
|
@@ -215,16 +212,15 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (compat_get_timespec(&t, rqtp))
|
|
|
|
|
|
+ if (compat_get_timespec64(&t, rqtp))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
- t64 = timespec_to_timespec64(t);
|
|
|
|
- if (!timespec64_valid(&t64))
|
|
|
|
|
|
+ if (!timespec64_valid(&t))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
if (flags & TIMER_ABSTIME)
|
|
if (flags & TIMER_ABSTIME)
|
|
rmtp = NULL;
|
|
rmtp = NULL;
|
|
current->restart_block.nanosleep.type = rmtp ? TT_COMPAT : TT_NONE;
|
|
current->restart_block.nanosleep.type = rmtp ? TT_COMPAT : TT_NONE;
|
|
current->restart_block.nanosleep.compat_rmtp = rmtp;
|
|
current->restart_block.nanosleep.compat_rmtp = rmtp;
|
|
- return hrtimer_nanosleep(&t64, flags & TIMER_ABSTIME ?
|
|
|
|
|
|
+ return hrtimer_nanosleep(&t, flags & TIMER_ABSTIME ?
|
|
HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
|
|
HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
|
|
which_clock);
|
|
which_clock);
|
|
}
|
|
}
|