s390/32bit: fix cmpxchg64
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 21 Jan 2014 13:03:58 +0000 (14:03 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 22 Jan 2014 13:02:15 +0000 (14:02 +0100)
Fix broken inline assembly contraints for cmpxchg64 on 32bit.

Fixes this crash:

specification exception: 0006 [#1] SMP
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.13.0 #4
task: 005a16c8 ti: 00592000 task.ti: 00592000
Krnl PSW : 070ce000 8029abd6 (lockref_get+0x3e/0x9c)
...
Krnl Code: 8029abcca71a0001           ahi     %r1,1
           8029abd0: 1852               lr      %r5,%r2
          #8029abd2bb40f064           cds     %r4,%r0,100(%r15)
          >8029abd6: 1943               cr      %r4,%r3
           8029abd8: 1815               lr      %r1,%r5
Call Trace:
([<0000000078e01870>] 0x78e01870)
 [<000000000021105a>] sysfs_mount+0xd2/0x1c8
 [<00000000001b551e>] mount_fs+0x3a/0x134
 [<00000000001ce768>] vfs_kern_mount+0x44/0x11c
 [<00000000001ce864>] kern_mount_data+0x24/0x3c
 [<00000000005cc4b8>] sysfs_init+0x74/0xd4
 [<00000000005cb5b4>] mnt_init+0xe0/0x1fc
 [<00000000005cb16a>] vfs_caches_init+0xb6/0x14c
 [<00000000005be794>] start_kernel+0x318/0x33c
 [<000000000010001c>] _stext+0x1c/0x80

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/cmpxchg.h

index 0f636cb..4236408 100644 (file)
@@ -185,11 +185,12 @@ static inline unsigned long long __cmpxchg64(void *ptr,
 {
        register_pair rp_old = {.pair = old};
        register_pair rp_new = {.pair = new};
+       unsigned long long *ullptr = ptr;
 
        asm volatile(
                "       cds     %0,%2,%1"
-               : "+&d" (rp_old), "=Q" (ptr)
-               : "d" (rp_new), "Q" (ptr)
+               : "+d" (rp_old), "+Q" (*ullptr)
+               : "d" (rp_new)
                : "memory", "cc");
        return rp_old.pair;
 }