linux/arch/s390
Sean Christopherson 347125705f KVM: s390: Return last valid slot if approx index is out-of-bounds
commit 97daa028f3 upstream.

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: afdad61615 ("KVM: s390: Fix storage attributes migration with memory slots")
Cc: stable@vger.kernel.org # 4.19.x: 0774a964ef56: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-29 16:33:16 +02:00
..
appldata
boot s390: make 'install' not depend on vmlinux 2020-03-12 13:00:13 +01:00
configs s390: update defconfigs 2019-10-04 16:37:33 +02:00
crypto s390/crypto: Fix unsigned variable compared with zero 2019-12-31 16:45:41 +01:00
hypfs Merge branch 'work.mount3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-09-24 12:33:34 -07:00
include s390: prevent leaking kernel address in BEAR 2020-04-13 10:48:06 +02:00
kernel s390/cpum_sf: Fix wrong page count in error message 2020-04-23 10:36:35 +02:00
kvm KVM: s390: Return last valid slot if approx index is out-of-bounds 2020-04-29 16:33:16 +02:00
lib
mm KVM: s390: vsie: Fix possible race when shadowing region 3 tables 2020-04-23 10:36:37 +02:00
net s390/bpf: Use kvcalloc for addrs array 2019-12-31 16:45:06 +01:00
numa
oprofile
pci s390/pci: Fix unexpected write combine on resource 2020-03-12 13:00:22 +01:00
purgatory s390/purgatory: do not build purgatory with kcov, kasan and friends 2020-01-12 12:21:40 +01:00
scripts
tools
Kbuild
Kconfig Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
Kconfig.debug
Makefile s390: make 'install' not depend on vmlinux 2020-03-12 13:00:13 +01:00