Message ID | 20230127025237.269680-5-jarkko@profian.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RFC,1/8] KVM: SVM: fix: calculate end instead of passing size | expand |
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 4a8e552d8cfe..d76127f1499a 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3745,6 +3745,11 @@ static kvm_pfn_t gfn_to_pfn_restricted(struct kvm *kvm, gfn_t gfn) int order = 0; slot = gfn_to_memslot(kvm, gfn); + if (!slot) { + pr_err("SEV: Failure retrieving memslot for GFN 0x%llx\n", gfn); + return INVALID_PAGE; + } + if (!kvm_slot_can_be_private(slot)) { pr_err("SEV: Failure retrieving restricted memslot for GFN 0x%llx, flags 0x%x, userspace_addr: 0x%lx\n", gfn, slot->flags, slot->userspace_addr);