aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2014-08-22 14:20:24 +0100
committerMark Brown <broonie@kernel.org>2015-01-22 21:27:28 +0000
commitadf5da773504328b2520ecf63f2098eaef982349 (patch)
tree97d71d4cda69f496985f1376fc374e405f23c3cb
parent2fee2fdbfb9e95f592c6fbfab263d8dc86d5772e (diff)
downloadlinux-linaro-stable-adf5da773504328b2520ecf63f2098eaef982349.tar.gz
arm64: ptrace: fix compat reg getter/setter return values
copy_{to,from}_user return the number of bytes remaining on failure, not an error code. This patch returns -EFAULT when the copy operation didn't complete, rather than expose the number of bytes not copied directly to userspace. Signed-off-by: Will Deacon <will.deacon@arm.com> (cherry picked from commit 85487edd252fa04718dcd735bc0f41213bbb9546) Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--arch/arm64/kernel/ptrace.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index f9177993d135..2b453624d5ad 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -656,8 +656,10 @@ static int compat_gpr_get(struct task_struct *target,
kbuf += sizeof(reg);
} else {
ret = copy_to_user(ubuf, &reg, sizeof(reg));
- if (ret)
+ if (ret) {
+ ret = -EFAULT;
break;
+ }
ubuf += sizeof(reg);
}
@@ -695,8 +697,10 @@ static int compat_gpr_set(struct task_struct *target,
kbuf += sizeof(reg);
} else {
ret = copy_from_user(&reg, ubuf, sizeof(reg));
- if (ret)
- return ret;
+ if (ret) {
+ ret = -EFAULT;
+ break;
+ }
ubuf += sizeof(reg);
}