summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>2019-03-06 04:10:38 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2019-07-03 08:19:36 +0300
commit6fbcdd59094ade30db63f32316e9502425d7b256 (patch)
treeb8bb4bd4a9c755717f4513f876547040eabaa78f
parent3fefd1cd95df04da67c83c1cb93b663f04b3324f (diff)
downloadlinux-6fbcdd59094ade30db63f32316e9502425d7b256.tar.xz
powerpc: Add barrier_nospec to raw_copy_in_user()
Commit ddf35cf3764b ("powerpc: Use barrier_nospec in copy_from_user()") Added barrier_nospec before loading from user-controlled pointers. The intention was to order the load from the potentially user-controlled pointer vs a previous branch based on an access_ok() check or similar. In order to achieve the same result, add a barrier_nospec to the raw_copy_in_user() function before loading from such a user-controlled pointer. Fixes: ddf35cf3764b ("powerpc: Use barrier_nospec in copy_from_user()") Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/uaccess.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 76f34346b642..8b03eb44e876 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -312,6 +312,7 @@ raw_copy_in_user(void __user *to, const void __user *from, unsigned long n)
{
unsigned long ret;
+ barrier_nospec();
allow_user_access(to, from, n);
ret = __copy_tofrom_user(to, from, n);
prevent_user_access(to, from, n);