mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[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 <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jamie Lokier <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
d55b5fdaf4
commit
796f8d9b98
1 changed files with 5 additions and 0 deletions
|
|
@ -365,6 +365,11 @@ retry:
|
|||
if (bh1 != bh2)
|
||||
spin_unlock(&bh2->lock);
|
||||
|
||||
if (unlikely(op_ret != -EFAULT)) {
|
||||
ret = op_ret;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* futex_atomic_op_inuser needs to both read and write
|
||||
* *(int __user *)uaddr2, but we can't modify it
|
||||
* non-atomically. Therefore, if get_user below is not
|
||||
|
|
|
|||
Loading…
Reference in a new issue