]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: s390: Return last valid slot if approx index is out-of-bounds
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 8 Apr 2020 06:40:59 +0000 (23:40 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Apr 2020 14:39:57 +0000 (10:39 -0400)
commitf2ac43f3b23bf8b4e3cee86dfd4e0eee0f7e215e
tree30c1179dba211ba92a3763c21dfbb11ee8aee3d8
parent87b4f8807722332ab06137f23343cd256c2f1db1
KVM: s390: Return last valid slot if approx index is out-of-bounds

Return the index of the last valid slot from gfn_to_memslot_approx() if
its binary search loop yielded an out-of-bounds index.  The index can
be out-of-bounds if the specified gfn is less than the base of the
lowest memslot (which is also the last valid memslot).

Note, the sole caller, kvm_s390_get_cmma(), ensures used_slots is
non-zero.

Fixes: a7fa2e59b6afb ("KVM: s390: Fix storage attributes migration with memory slots")
Cc: stable@vger.kernel.org # 4.19.x: 5c9b24c32a98: KVM: Fix out of range accesses to memslots
Cc: stable@vger.kernel.org # 4.19.x
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200408064059.8957-3-sean.j.christopherson@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/s390/kvm/kvm-s390.c