sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()
We do need access_process_vm() to access the target's reg_window.
However, access to caller's memory (storing the result in
genregs32_get(), fetching the new values in case of genregs32_set())
should be done by normal uaccess primitives.
Fixes: ad4f957640 ([SPARC64]: Fix user accesses in regset code.)
Cc: stable@kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -572,19 +572,13 @@ static int genregs32_get(struct task_struct *target,
|
|||||||
for (; count > 0 && pos < 32; count--) {
|
for (; count > 0 && pos < 32; count--) {
|
||||||
if (access_process_vm(target,
|
if (access_process_vm(target,
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
®_window[pos],
|
®_window[pos++],
|
||||||
®, sizeof(reg),
|
®, sizeof(reg),
|
||||||
FOLL_FORCE)
|
FOLL_FORCE)
|
||||||
!= sizeof(reg))
|
!= sizeof(reg))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (access_process_vm(target,
|
if (put_user(reg, u++))
|
||||||
(unsigned long) u,
|
|
||||||
®, sizeof(reg),
|
|
||||||
FOLL_FORCE | FOLL_WRITE)
|
|
||||||
!= sizeof(reg))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
pos++;
|
|
||||||
u++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -684,12 +678,7 @@ static int genregs32_set(struct task_struct *target,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (; count > 0 && pos < 32; count--) {
|
for (; count > 0 && pos < 32; count--) {
|
||||||
if (access_process_vm(target,
|
if (get_user(reg, u++))
|
||||||
(unsigned long)
|
|
||||||
u,
|
|
||||||
®, sizeof(reg),
|
|
||||||
FOLL_FORCE)
|
|
||||||
!= sizeof(reg))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (access_process_vm(target,
|
if (access_process_vm(target,
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
|
|||||||
Reference in New Issue
Block a user