Commit 036132b3 authored by Dave Kleikamp's avatar Dave Kleikamp Committed by Greg Kroah-Hartman

sparc64: don't treat 64-bit syscall return codes as 32-bit

[ Upstream commit 1535bd8a ]

When checking a system call return code for an error,
linux_sparc_syscall was sign-extending the lower 32-bit value and
comparing it to -ERESTART_RESTARTBLOCK. lseek can return valid return
codes whose lower 32-bits alone would indicate a failure (such as 4G-1).
Use the whole 64-bit value to check for errors. Only the 32-bit path
should sign extend the lower 32-bit value.
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Acked-by: default avatarBob Picco <bob.picco@oracle.com>
Acked-by: default avatarAllen Pais <allen.pais@oracle.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e5097041
...@@ -184,7 +184,8 @@ linux_sparc_syscall32: ...@@ -184,7 +184,8 @@ linux_sparc_syscall32:
mov %i0, %l5 ! IEU1 mov %i0, %l5 ! IEU1
5: call %l7 ! CTI Group brk forced 5: call %l7 ! CTI Group brk forced
srl %i5, 0, %o5 ! IEU1 srl %i5, 0, %o5 ! IEU1
ba,a,pt %xcc, 3f ba,pt %xcc, 3f
sra %o0, 0, %o0
/* Linux native system calls enter here... */ /* Linux native system calls enter here... */
.align 32 .align 32
...@@ -212,7 +213,6 @@ linux_sparc_syscall: ...@@ -212,7 +213,6 @@ linux_sparc_syscall:
3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
ret_sys_call: ret_sys_call:
ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
sra %o0, 0, %o0
mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
sllx %g2, 32, %g2 sllx %g2, 32, %g2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment