Commit 1a83af8a authored by Li Jinyue's avatar Li Jinyue Committed by Erick Reyes
Browse files

BACKPORT: futex: Prevent overflow by strengthen input validation



UBSAN reports signed integer overflow in kernel/futex.c:

 UBSAN: Undefined behaviour in kernel/futex.c:2041:18
 signed integer overflow:
 0 - -2147483648 cannot be represented in type 'int'

Add a sanity check to catch negative values of nr_wake and nr_requeue.

Signed-off-by: default avatarLi Jinyue <lijinyue@huawei.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarErick Reyes <erickreyes@google.com>
Cc: peterz@infradead.org
Cc: dvhart@infradead.org
Cc: stable@vger.kernel.org

Link: https://lkml.kernel.org/r/1513242294-31786-1-git-send-email-lijinyue@huawei.com
Cherry-picked from fbe0e839

Change-Id: I954cc2848678318b60ec3f103d0c15f87b4605a4
parent 0efe4409
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment