]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-parisc/futex.h
[SCSI] sd: remove command-size switching code
[linux-2.6-omap-h63xx.git] / include / asm-parisc / futex.h
index dbee6e60aa8139e66897ba65ba4ac9155bf00dab..0c705c3a55efc01305dbea4e14eecf63c0f3f05e 100644 (file)
@@ -4,8 +4,8 @@
 #ifdef __KERNEL__
 
 #include <linux/futex.h>
+#include <linux/uaccess.h>
 #include <asm/errno.h>
-#include <asm/uaccess.h>
 
 static inline int
 futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
@@ -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*/