powerpc/align: Convert emulate_spe() to user_access_begin
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Fri, 12 Mar 2021 13:25:11 +0000 (13:25 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 3 Apr 2021 10:21:39 +0000 (21:21 +1100)
commit3fa3db32956d74c0784171ae0334685502bb169a
tree5703eec882a33e0ddbed5687d9fa7d9bca776dcf
parent9bd68dc5d7463cb959bff9ac4b6c7e578171de35
powerpc/align: Convert emulate_spe() to user_access_begin

This patch converts emulate_spe() to using user_access_begin
logic.

Since commit 662bbcb2747c ("mm, sched: Allow uaccess in atomic with
pagefault_disable()"), might_fault() doesn't fire when called from
sections where pagefaults are disabled, which must be the case
when using _inatomic variants of __get_user and __put_user. So
the might_fault() in user_access_begin() is not a problem.

There was a verification of user_mode() together with the access_ok(),
but there is a second verification of user_mode() just after, that
leads to immediate return. The access_ok() is now part of the
user_access_begin which is called after that other user_mode()
verification, so no need to check user_mode() again.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c95a648fdf75992c9d88f3c73cc23e7537fcf2ad.1615555354.git.christophe.leroy@csgroup.eu
arch/powerpc/kernel/align.c