Skip to content
Commit f1b9dd5e authored by Jim Mattson's avatar Jim Mattson Committed by Paolo Bonzini
Browse files

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: 8f964525

 ("KVM: Allow cross page reads and writes from cached translations.")
Reported-by: default avatarCfir Cohen <cfir@google.com>
Signed-off-by: default avatarJim Mattson <jmattson@google.com>
Reviewed-by: default avatarCfir Cohen <cfir@google.com>
Reviewed-by: default avatarMarc Orr <marcorr@google.com>
Cc: Andrew Honig <ahonig@google.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent ba7424b2
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment