]> git.itanic.dy.fi Git - linux-stable/commit
sparc32: fix a braino in fault handling in csum_and_copy_..._user()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 22 Oct 2023 23:34:28 +0000 (19:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Nov 2023 08:35:32 +0000 (09:35 +0100)
commit65e5a9890e03cfe9379275d1aa561643cbd62629
treef7b3bd948201fd9257936a818c9cc517fbbb4731
parent8b8cde8ebb872a6b62aee81869ad235a5eb251d9
sparc32: fix a braino in fault handling in csum_and_copy_..._user()

commit 1f36cd05e0081f2c75769a551d584c4ffb2a5660 upstream.

Fault handler used to make non-trivial calls, so it needed
to set a stack frame up.  Used to be
save ... - grab a stack frame, old %o... become %i...
....
ret - go back to address originally in %o7, currently %i7
 restore - switch to previous stack frame, in delay slot
Non-trivial calls had been gone since ab5e8b331244 and that code should
have become
retl - go back to address in %o7
 clr %o0 - have return value set to 0
What it had become instead was
ret - go back to address in %i7 - return address of *caller*
 clr %o0 - have return value set to 0
which is not good, to put it mildly - we forcibly return 0 from
csum_and_copy_{from,to}_iter() (which is what the call of that
thing had been inlined into) and do that without dropping the
stack frame of said csum_and_copy_..._iter().  Confuses the
hell out of the caller of csum_and_copy_..._iter(), obviously...

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Fixes: ab5e8b331244 "sparc32: propagate the calling conventions change down to __csum_partial_copy_sparc_generic()"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/sparc/lib/checksum_32.S