Commit 6fbcdd59 authored by Suraj Jitindar Singh's avatar Suraj Jitindar Singh Committed by Michael Ellerman

powerpc: Add barrier_nospec to raw_copy_in_user()

Commit ddf35cf3 ("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: ddf35cf3 ("powerpc: Use barrier_nospec in copy_from_user()")
Signed-off-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 3fefd1cd
...@@ -312,6 +312,7 @@ raw_copy_in_user(void __user *to, const void __user *from, unsigned long n) ...@@ -312,6 +312,7 @@ raw_copy_in_user(void __user *to, const void __user *from, unsigned long n)
{ {
unsigned long ret; unsigned long ret;
barrier_nospec();
allow_user_access(to, from, n); allow_user_access(to, from, n);
ret = __copy_tofrom_user(to, from, n); ret = __copy_tofrom_user(to, from, n);
prevent_user_access(to, from, n); prevent_user_access(to, from, n);
......
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