From 285eeef3591c85d3f73ed63e78e56ace422f2f99 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Thu, 20 Mar 2008 17:33:38 +0100 Subject: [PATCH] [S390] futex: let futex_atomic_cmpxchg_pt survive early functional tests. dda3a43bdd964d176d414219c90698077c9acba5 "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 --- arch/s390/lib/uaccess_pt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index 7e8efaade2ea1..5efdfe9f5e769 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) { -- 2.39.5