mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
fix compat futex code for private futexes
When the private futex support was added the compat code wasn't changed. The result is that code using compat code which fail, e.g., because the timeout values are not correctly passed. The following patch should fix that. Signed-off-by: Ulrich Drepper <drepper@redhat.com> Cc: Eric Dumazet <dada1@cosmosbay.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b9e82af823
commit
f0ede66fca
1 changed files with 5 additions and 4 deletions
|
@ -144,20 +144,21 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
ktime_t t, *tp = NULL;
|
ktime_t t, *tp = NULL;
|
||||||
int val2 = 0;
|
int val2 = 0;
|
||||||
|
int cmd = op & FUTEX_CMD_MASK;
|
||||||
|
|
||||||
if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) {
|
if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {
|
||||||
if (get_compat_timespec(&ts, utime))
|
if (get_compat_timespec(&ts, utime))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (!timespec_valid(&ts))
|
if (!timespec_valid(&ts))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
t = timespec_to_ktime(ts);
|
t = timespec_to_ktime(ts);
|
||||||
if (op == FUTEX_WAIT)
|
if (cmd == FUTEX_WAIT)
|
||||||
t = ktime_add(ktime_get(), t);
|
t = ktime_add(ktime_get(), t);
|
||||||
tp = &t;
|
tp = &t;
|
||||||
}
|
}
|
||||||
if (op == FUTEX_REQUEUE || op == FUTEX_CMP_REQUEUE
|
if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE
|
||||||
|| op == FUTEX_CMP_REQUEUE_PI)
|
|| cmd == FUTEX_CMP_REQUEUE_PI)
|
||||||
val2 = (int) (unsigned long) utime;
|
val2 = (int) (unsigned long) utime;
|
||||||
|
|
||||||
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
|
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
|
||||||
|
|
Loading…
Reference in a new issue