ARM: 8051/1: put_user: fix possible data corruption in put_user
commitb4fe083f59a6f9911e00affd42fc42d046f11504
authorAndrey Ryabinin <a.ryabinin@samsung.com>
Fri, 8 Nov 2019 12:35:05 +0000 (8 13:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:21:15 +0000 (10 11:21 +0100)
tree70221bd7bc485e078bb8f65af6cf9afc4b092d04
parente4cea4d4c5d9f5162c62bd1af102a781987489b6
ARM: 8051/1: put_user: fix possible data corruption in put_user

Commit 537094b64b229bf3ad146042f83e74cf6abe59df upstream.

According to arm procedure call standart r2 register is call-cloberred.
So after the result of x expression was put into r2 any following
function call in p may overwrite r2. To fix this, the result of p
expression must be saved to the temporary variable before the
assigment x expression to __r2.

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
Cc: stable@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/uaccess.h