aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2005-11-07 03:59:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:38 -0500
commit796f8d9b98fc92a5e9aaea8cf932957850332f51 (patch)
tree66e0a2bdf18e03c7dadba7c4c7b896533aa2e762 /kernel
parentd55b5fdaf40846221d543937b786956e27837fda (diff)
[PATCH] FUTEX_WAKE_OP: enhanced error handling
The code for FUTEX_WAKE_OP calls an arch callback, futex_atomic_op_inuser(). That callback can return an error code, but currently the caller assumes any error is EFAULT, and will try various things to resolve the fault before eventually giving up with EFAULT (regardless of the original error code). This is not a theoretical case - arch callbacks currently return -ENOSYS if the opcode they are given is bogus. This patch alters the code to detect non-EFAULT errors and return them directly to the user. Of course, whether -ENOSYS is the correct return value for the bogus opcode case, or whether EINVAL would be more appropriate is another question. Signed-off-by: David Gibson <dwg@au1.ibm.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jamie Lokier <jamie@shareable.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/futex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 3b4d5ad44cc6..aca8d10704f6 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -365,6 +365,11 @@ retry:
365 if (bh1 != bh2) 365 if (bh1 != bh2)
366 spin_unlock(&bh2->lock); 366 spin_unlock(&bh2->lock);
367 367
368 if (unlikely(op_ret != -EFAULT)) {
369 ret = op_ret;
370 goto out;
371 }
372
368 /* futex_atomic_op_inuser needs to both read and write 373 /* futex_atomic_op_inuser needs to both read and write
369 * *(int __user *)uaddr2, but we can't modify it 374 * *(int __user *)uaddr2, but we can't modify it
370 * non-atomically. Therefore, if get_user below is not 375 * non-atomically. Therefore, if get_user below is not