]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: Disallow wraparound in kvm_gfn_to_hva_cache_init
authorJim Mattson <jmattson@google.com>
Mon, 17 Dec 2018 21:53:33 +0000 (13:53 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Dec 2018 10:28:22 +0000 (11:28 +0100)
commit9286c4867f33d6a3b4788419158fa0f8419ac81b
treea3905b1d27e8e4514953b4f0aa1eec705fa30afd
parentaace482ad5c5b959cb650975b421707f317c3b4d
kvm: Disallow wraparound in kvm_gfn_to_hva_cache_init

Previously, in the case where (gpa + len) wrapped around, the entire
region was not validated, as the comment claimed. It doesn't actually
seem that wraparound should be allowed here at all.

Furthermore, since some callers don't check the return code from this
function, it seems prudent to clear ghc->memslot in the event of an
error.

Fixes: d2ac5d18e3592 ("KVM: Allow cross page reads and writes from cached translations.")
Reported-by: Cfir Cohen <cfir@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Cfir Cohen <cfir@google.com>
Reviewed-by: Marc Orr <marcorr@google.com>
Cc: Andrew Honig <ahonig@google.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
virt/kvm/kvm_main.c