]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: avoid double put_page with gfn-to-pfn cache
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 29 Mar 2022 17:11:47 +0000 (13:11 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 2 Apr 2022 09:34:39 +0000 (05:34 -0400)
commit9427fe083a372ac2bb5559850c98754424756f4d
treec0784da492f0d1efb29821eca40379199abf2ce7
parent6aae4aa12aee34447ccb15a249e7783d5d67ed87
KVM: avoid double put_page with gfn-to-pfn cache

If the cache's user host virtual address becomes invalid, there
is still a path from kvm_gfn_to_pfn_cache_refresh() where __release_gpc()
could release the pfn but the gpc->pfn field has not been overwritten
with an error value.  If this happens, kvm_gfn_to_pfn_cache_unmap will
call put_page again on the same page.

Cc: stable@vger.kernel.org
Fixes: 6c84388d65b5 ("KVM: Reinstate gfn_to_pfn_cache with invalidation support")
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/pfncache.c