From: Heiko Carstens Date: Thu, 20 Mar 2008 16:33:38 +0000 (+0100) Subject: [S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=504e75d0ed3389747e40a4aaa4b1f4e569576665;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests. a0c1e9073ef7428a14309cba010633a6cd6719ea "futex: runtime enable pi and robust functionality" introduces a test wether futex in atomic stuff works or not. It does that by writing to address 0 of the kernel address space. This will crash on older machines where addressing mode switching is enabled but where the mvcos instruction is not available. Page table walking is done by hand and therefore the code tries to access current->mm which is NULL. Therefore add an extra check, so we survive the early test. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index 7e8efaade2e..5efdfe9f5e7 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c @@ -406,6 +406,8 @@ int futex_atomic_cmpxchg_pt(int __user *uaddr, int oldval, int newval) { int ret; + if (!current->mm) + return -EFAULT; spin_lock(¤t->mm->page_table_lock); uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr); if (!uaddr) {