futex: futex_wake_op, fix sign_extend32 sign bits
commitd70ef22892
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 commit30d6e0a419
("futex: Remove duplicated code and fix undefined behaviour") till now. Fixes:30d6e0a419
("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7d56aed52b
commit
cde6d68b1a
@ -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)) {
|
||||
|
Reference in New Issue
Block a user