]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: fix lazy allocation of rmaps
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Oct 2021 17:05:00 +0000 (13:05 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 18 Oct 2021 18:07:17 +0000 (14:07 -0400)
commit2583d73cc35ac951ae52ca2d5f2159dc8ac0c1ec
tree7fe205877157bfd74eb55bd7756541d10725252d
parentcf7965f7d08edd154f043e88e5a587b707c23ed8
KVM: X86: fix lazy allocation of rmaps

If allocation of rmaps fails, but some of the pointers have already been written,
those pointers can be cleaned up when the memslot is freed, or even reused later
for another attempt at allocating the rmaps.  Therefore there is no need to
WARN, as done for example in memslot_rmap_alloc, but the allocation *must* be
skipped lest KVM will overwrite the previous pointer and will indeed leak memory.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c