mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[SPARC64]: Simplify user fault fixup handling.
Instead of doing byte-at-a-time user accesses to figure out where the fault occurred, read the saved fault_address from the current thread structure. For the sake of defensive programming, if the fault_address does not fall into the user buffer range, simply assume the whole area faulted. This will cause the fixup for copy_from_user() to clear the entire kernel side buffer. Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
5fd29752f0
commit
efdc1e2083
3 changed files with 34 additions and 45 deletions
|
|
@ -251,7 +251,7 @@ copy_from_user(void *to, const void __user *from, unsigned long size)
|
|||
{
|
||||
unsigned long ret = ___copy_from_user(to, from, size);
|
||||
|
||||
if (ret)
|
||||
if (unlikely(ret))
|
||||
ret = copy_from_user_fixup(to, from, size);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@ copy_to_user(void __user *to, const void *from, unsigned long size)
|
|||
{
|
||||
unsigned long ret = ___copy_to_user(to, from, size);
|
||||
|
||||
if (ret)
|
||||
if (unlikely(ret))
|
||||
ret = copy_to_user_fixup(to, from, size);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
|
|||
{
|
||||
unsigned long ret = ___copy_in_user(to, from, size);
|
||||
|
||||
if (ret)
|
||||
if (unlikely(ret))
|
||||
ret = copy_in_user_fixup(to, from, size);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue