aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-06-01 03:46:41 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-01 11:18:28 -0400
commitf0ede66fca23cfee4ee80b48298007d930f49bbe (patch)
tree2deb9337847d472fe776d00bc4f53c7a82d0aea9
parentb9e82af823c10d8f981072e0d7c3a8a31f73e0bd (diff)
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>
-rw-r--r--kernel/futex_compat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 338a9b489fbc..27478948b318 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -144,20 +144,21 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
144 struct timespec ts; 144 struct timespec ts;
145 ktime_t t, *tp = NULL; 145 ktime_t t, *tp = NULL;
146 int val2 = 0; 146 int val2 = 0;
147 int cmd = op & FUTEX_CMD_MASK;
147 148
148 if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) { 149 if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {
149 if (get_compat_timespec(&ts, utime)) 150 if (get_compat_timespec(&ts, utime))
150 return -EFAULT; 151 return -EFAULT;
151 if (!timespec_valid(&ts)) 152 if (!timespec_valid(&ts))
152 return -EINVAL; 153 return -EINVAL;
153 154
154 t = timespec_to_ktime(ts); 155 t = timespec_to_ktime(ts);
155 if (op == FUTEX_WAIT) 156 if (cmd == FUTEX_WAIT)
156 t = ktime_add(ktime_get(), t); 157 t = ktime_add(ktime_get(), t);
157 tp = &t; 158 tp = &t;
158 } 159 }
159 if (op == FUTEX_REQUEUE || op == FUTEX_CMP_REQUEUE 160 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE
160 || op == FUTEX_CMP_REQUEUE_PI) 161 || cmd == FUTEX_CMP_REQUEUE_PI)
161 val2 = (int) (unsigned long) utime; 162 val2 = (int) (unsigned long) utime;
162 163
163 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); 164 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);