[PARISC] futex: special case cmpxchg NULL in kernel space
[sfrench/cifs-2.6.git] / include / asm-parisc / futex.h
index dbee6e60aa8139e66897ba65ba4ac9155bf00dab..fdc6d055ef7f2af68872f2f195d8b417ebb9558f 100644 (file)
@@ -56,6 +56,12 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
        int err = 0;
        int uval;
 
+       /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is
+        * our gateway page, and causes no end of trouble...
+        */
+       if (segment_eq(KERNEL_DS, get_fs()) && !uaddr)
+               return -EFAULT;
+
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
                return -EFAULT;
 
@@ -67,5 +73,5 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
        return uval;
 }
 
-#endif
-#endif
+#endif /*__KERNEL__*/
+#endif /*_ASM_PARISC_FUTEX_H*/