Commit 96b9a2c0 authored by Al Viro's avatar Al Viro Committed by Kelsey Skunberg

sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()

BugLink: https://bugs.launchpad.net/bugs/1885932

[ Upstream commit 142cd252 ]

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: ad4f9576 ([SPARC64]: Fix user accesses in regset code.)
Cc: stable@kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent 0de07ccb
......@@ -534,13 +534,8 @@ static int genregs32_get(struct task_struct *target,
&reg, sizeof(reg), 0)
!= sizeof(reg))
return -EFAULT;
if (access_process_vm(target,
(unsigned long) u,
&reg, sizeof(reg), 1)
!= sizeof(reg))
if (put_user(reg, u++))
return -EFAULT;
pos++;
u++;
}
}
}
......@@ -639,11 +634,7 @@ static int genregs32_set(struct task_struct *target,
}
} else {
for (; count > 0 && pos < 32; count--) {
if (access_process_vm(target,
(unsigned long)
u,
&reg, sizeof(reg), 0)
!= sizeof(reg))
if (get_user(reg, u++))
return -EFAULT;
if (access_process_vm(target,
(unsigned long)
......
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