提交 85487edd 编写于 作者: W Will Deacon

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: NWill Deacon <will.deacon@arm.com>
上级 27d7ff27
...@@ -663,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target, ...@@ -663,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target,
kbuf += sizeof(reg); kbuf += sizeof(reg);
} else { } else {
ret = copy_to_user(ubuf, &reg, sizeof(reg)); ret = copy_to_user(ubuf, &reg, sizeof(reg));
if (ret) if (ret) {
ret = -EFAULT;
break; break;
}
ubuf += sizeof(reg); ubuf += sizeof(reg);
} }
...@@ -702,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target, ...@@ -702,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target,
kbuf += sizeof(reg); kbuf += sizeof(reg);
} else { } else {
ret = copy_from_user(&reg, ubuf, sizeof(reg)); ret = copy_from_user(&reg, ubuf, sizeof(reg));
if (ret) if (ret) {
return ret; ret = -EFAULT;
break;
}
ubuf += sizeof(reg); ubuf += sizeof(reg);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册