]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Fix out of range accesses to memslots
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 20 Mar 2020 20:55:40 +0000 (13:55 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 26 Mar 2020 09:58:27 +0000 (05:58 -0400)
commit65e59d4991e8ca108ec339ee2e0dd2ed973c127e
treee79fd43bb434c3bcd34843d7caee2e65b7f4af25
parent0a86e6deb4951188968755b018f33a6639341c16
KVM: Fix out of range accesses to memslots

Reset the LRU slot if it becomes invalid when deleting a memslot to fix
an out-of-bounds/use-after-free access when searching through memslots.

Explicitly check for there being no used slots in search_memslots(), and
in the caller of s390's approximation variant.

Fixes: 094cff2c4a84 ("KVM: Dynamically size memslot array based on number of used slots")
Reported-by: Qian Cai <cai@lca.pw>
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/s390/kvm/kvm-s390.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c