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: 8f964525a121f ("KVM: Allow cross page reads and writes from cached translations.")
Reported-by: Cfir Cohen <[email protected]>
Signed-off-by: Jim Mattson <[email protected]>
Reviewed-by: Cfir Cohen <[email protected]>
Reviewed-by: Marc Orr <[email protected]>
Cc: Andrew Honig <[email protected]>
Signed-off-by: Radim Krčmář <[email protected]>