diff options
author | Will Deacon <will.deacon@arm.com> | 2014-08-26 18:13:23 +0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-08-28 00:49:45 +0400 |
commit | bd218bce92d3868ba4fe5e9e3eb8199d2aa614af (patch) | |
tree | 18c3956239fc631afa20162018c40cf2c97e9f12 | |
parent | 18d457661fb9fa69352822ab98d39331c3d0e571 (diff) | |
download | linux-bd218bce92d3868ba4fe5e9e3eb8199d2aa614af.tar.xz |
KVM: ARM/arm64: return -EFAULT if copy_from_user fails in set_timer_reg
We currently return the number of bytes not copied if set_timer_reg
fails, which is almost certainly not what userspace would like.
This patch returns -EFAULT instead.
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r-- | arch/arm/kvm/guest.c | 2 | ||||
-rw-r--r-- | arch/arm64/kvm/guest.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 813e49258690..cc0b78769bd8 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -163,7 +163,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); if (ret != 0) - return ret; + return -EFAULT; return kvm_arm_timer_set_reg(vcpu, reg->id, val); } diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 8d1ec2887a26..76794692c20b 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -174,7 +174,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); if (ret != 0) - return ret; + return -EFAULT; return kvm_arm_timer_set_reg(vcpu, reg->id, val); } |