summaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2017-11-30 15:35:44 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-26 08:48:51 +0200
commitcde6d68b1a4f67b8b1c7f71c710fd8590ef725a3 (patch)
tree76a48189eaf2f872d286fbca9689dc098cec74a9 /kernel/futex.c
parent7d56aed52b52450181c7ba58cb680739cb7e5737 (diff)
downloadlinux-stable-cde6d68b1a4f67b8b1c7f71c710fd8590ef725a3.tar.gz
linux-stable-cde6d68b1a4f67b8b1c7f71c710fd8590ef725a3.tar.bz2
linux-stable-cde6d68b1a4f67b8b1c7f71c710fd8590ef725a3.zip
futex: futex_wake_op, fix sign_extend32 sign bits
commit d70ef22892ed6c066e51e118b225923c9b74af34 upstream. sign_extend32 counts the sign bit parameter from 0, not from 1. So we have to use "11" for 12th bit, not "12". This mistake means we have not allowed negative op and cmp args since commit 30d6e0a4190d ("futex: Remove duplicated code and fix undefined behaviour") till now. Fixes: 30d6e0a4190d ("futex: Remove duplicated code and fix undefined behaviour") Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Darren Hart <dvhart@infradead.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 44a905c6c630..a26d217c99fe 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1457,8 +1457,8 @@ static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user *uaddr)
{
unsigned int op = (encoded_op & 0x70000000) >> 28;
unsigned int cmp = (encoded_op & 0x0f000000) >> 24;
- int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 12);
- int cmparg = sign_extend32(encoded_op & 0x00000fff, 12);
+ int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 11);
+ int cmparg = sign_extend32(encoded_op & 0x00000fff, 11);
int oldval, ret;
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {