Commit 6573a691 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: Don't WARN if kvm_pfn_to_page() encounters a "reserved" pfn

Drop a WARN_ON() if kvm_pfn_to_page() encounters a "reserved" pfn, which
in this context means a struct page that has PG_reserved but is not a/the
ZERO_PAGE and is not a ZONE_DEVICE page.  The usage, via gfn_to_page(),
in x86 is safe as gfn_to_page() is used only to retrieve a page from
KVM-controlled memslot, but the usage in PPC and s390 operates on
arbitrary gfns and thus memslots that can be backed by incompatible
memory.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Message-Id: <20220429010416.2788472-7-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent fe1911aa
...@@ -2725,10 +2725,8 @@ static struct page *kvm_pfn_to_page(kvm_pfn_t pfn) ...@@ -2725,10 +2725,8 @@ static struct page *kvm_pfn_to_page(kvm_pfn_t pfn)
if (is_error_noslot_pfn(pfn)) if (is_error_noslot_pfn(pfn))
return KVM_ERR_PTR_BAD_PAGE; return KVM_ERR_PTR_BAD_PAGE;
if (kvm_is_reserved_pfn(pfn)) { if (kvm_is_reserved_pfn(pfn))
WARN_ON(1);
return KVM_ERR_PTR_BAD_PAGE; return KVM_ERR_PTR_BAD_PAGE;
}
return pfn_to_page(pfn); return pfn_to_page(pfn);
} }
......
Markdown is supported
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