Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1352402
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.4 10/74] mips/kvm: fix ioctl error handling |
| Date | 2016-03-08 01:30 +0100 |
| Message-ID | <radHd-1Il-23@gated-at.bofh.it> (permalink) |
| References | <radnP-1zk-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael S. Tsirkin <mst@redhat.com>
commit 0178fd7dcc4451fcb90bec5e91226586962478d2 upstream.
Returning directly whatever copy_to_user(...) or copy_from_user(...)
returns may not do the right thing if there's a pagefault:
copy_to_user/copy_from_user return the number of bytes not copied in
this case, but ioctls need to return -EFAULT instead.
Fix up kvm on mips to do
return copy_to_user(...)) ? -EFAULT : 0;
and
return copy_from_user(...)) ? -EFAULT : 0;
everywhere.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/kvm/mips.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -702,7 +702,7 @@ static int kvm_mips_get_reg(struct kvm_v
} else if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U128) {
void __user *uaddr = (void __user *)(long)reg->addr;
- return copy_to_user(uaddr, vs, 16);
+ return copy_to_user(uaddr, vs, 16) ? -EFAULT : 0;
} else {
return -EINVAL;
}
@@ -732,7 +732,7 @@ static int kvm_mips_set_reg(struct kvm_v
} else if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U128) {
void __user *uaddr = (void __user *)(long)reg->addr;
- return copy_from_user(vs, uaddr, 16);
+ return copy_from_user(vs, uaddr, 16) ? -EFAULT : 0;
} else {
return -EINVAL;
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.4 00/74] 4.4.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 09/74] parisc: Fix ptrace syscall number and return value modification Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 18/74] arm/arm64: KVM: Fix ioctl error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 10/74] mips/kvm: fix ioctl error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 12/74] fbcon: set a default value to blink interval Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 03/74] Btrfs: fix deadlock running delayed iputs at transaction commit time Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 07/74] block: Initialize max_dev_sectors to 0 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
[PATCH 4.4 16/74] vfio: fix ioctl error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:30 +0100
Re: [PATCH 4.4 00/74] 4.4.5-stable review Guenter Roeck <linux@roeck-us.net> - 2016-03-08 12:50 +0100
Re: [PATCH 4.4 00/74] 4.4.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 15:20 +0100
Re: [PATCH 4.4 00/74] 4.4.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 15:40 +0100
Re: [PATCH 4.4 00/74] 4.4.5-stable review Kevin Hilman <khilman@baylibre.com> - 2016-03-09 06:40 +0100
Re: [PATCH 4.4 00/74] 4.4.5-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-03-08 17:30 +0100
Re: [PATCH 4.4 00/74] 4.4.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-09 03:10 +0100
csiph-web