linux/virt/kvm
Jim Mattson e713956a01 kvm: Disallow wraparound in kvm_gfn_to_hva_cache_init
commit f1b9dd5eb8 upstream.

Previously, in the case where (gpa + len) wrapped around, the entire
region was not validated, as the comment claimed. It doesn't actually
seem that wraparound should be allowed here at all.

Furthermore, since some callers don't check the return code from this
function, it seems prudent to clear ghc->memslot in the event of an
error.

Fixes: 8f964525a1 ("KVM: Allow cross page reads and writes from cached translations.")
Reported-by: Cfir Cohen <cfir@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Cfir Cohen <cfir@google.com>
Reviewed-by: Marc Orr <marcorr@google.com>
Cc: Andrew Honig <ahonig@google.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-04-04 16:14:04 +01:00
..
arm KVM: Protect device ops->create and list_add with kvm->lock 2019-03-25 17:32:35 +00:00
assigned-dev.c kvm: Use pci_enable_msix_exact() instead of pci_enable_msix() 2014-04-28 11:13:06 +02:00
async_pf.c KVM: async_pf: do not warn on page allocation failures 2016-03-08 12:15:30 +00:00
async_pf.h KVM: Halt vcpu if page it tries to access is swapped out 2011-01-12 11:21:39 +02:00
coalesced_mmio.c KVM: return an error code in kvm_vm_ioctl_register_coalesced_mmio() 2014-01-30 11:56:09 +01:00
coalesced_mmio.h KVM: Make coalesced mmio use a device per zone 2011-09-25 19:17:57 +03:00
eventfd.c KVM: kvm_io_bus_unregister_dev() should never fail 2017-07-18 18:40:22 +01:00
ioapic.c KVM: x86: always exit on EOIs for interrupts listed in the IOAPIC redir table 2014-09-05 16:36:32 -07:00
ioapic.h kvm: make local functions static 2014-01-08 19:02:58 -02:00
iodev.h KVM: remove in_range from io devices 2009-09-10 08:33:05 +03:00
iommu.c kvm: fix excessive pages un-pinning in kvm_iommu_map error path. 2014-11-05 11:43:13 +00:00
irq_comm.c kvm/irqchip: Speed up KVM_SET_GSI_ROUTING 2014-05-05 16:29:11 +02:00
irqchip.c KVM: irqfd: fix NULL pointer dereference in kvm_irq_map_gsi 2016-08-22 22:38:08 +01:00
Kconfig KVM: async_pf: Provide additional direct page notification 2014-01-30 12:51:38 +01:00
kvm_main.c kvm: Disallow wraparound in kvm_gfn_to_hva_cache_init 2019-04-04 16:14:04 +01:00
vfio.c vfio: New external user group/file match 2017-10-12 15:27:55 +01:00