]> 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)
commitb0bab221b1c9022cd18d8464760a8bbb2cc057aa
treea3905b1d27e8e4514953b4f0aa1eec705fa30afd
parent34f8aa8ac1eda5ccf153f2a3b4fd649776e9b3fa
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: ead289ec8ee10 ("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