Skip to content

Commit f0ede66

Browse files
Ulrich DrepperLinus Torvalds
authored andcommitted
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 <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b9e82af commit f0ede66

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernel/futex_compat.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,21 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
144144
struct timespec ts;
145145
ktime_t t, *tp = NULL;
146146
int val2 = 0;
147+
int cmd = op & FUTEX_CMD_MASK;
147148

148-
if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) {
149+
if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {
149150
if (get_compat_timespec(&ts, utime))
150151
return -EFAULT;
151152
if (!timespec_valid(&ts))
152153
return -EINVAL;
153154

154155
t = timespec_to_ktime(ts);
155-
if (op == FUTEX_WAIT)
156+
if (cmd == FUTEX_WAIT)
156157
t = ktime_add(ktime_get(), t);
157158
tp = &t;
158159
}
159-
if (op == FUTEX_REQUEUE || op == FUTEX_CMP_REQUEUE
160-
|| op == FUTEX_CMP_REQUEUE_PI)
160+
if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE
161+
|| cmd == FUTEX_CMP_REQUEUE_PI)
161162
val2 = (int) (unsigned long) utime;
162163

163164
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);

0 commit comments

Comments
 (0)