Commit aca0ec97 authored by Ackerley Tng's avatar Ackerley Tng Committed by Paolo Bonzini

KVM: x86/mmu: fix determination of max NPT mapping level for private pages

The `if (req_max_level)` test was meant ignore req_max_level if
PG_LEVEL_NONE was returned. Hence, this function should return
max_level instead of the ignored req_max_level.

This is only a latent issue for now, since guest_memfd does not
support large pages.
Signed-off-by: default avatarAckerley Tng <ackerleytng@google.com>
Message-ID: <20240801173955.1975034-1-ackerleytng@google.com>
Fixes: f32fb328 ("KVM: x86: Add hook for determining max NPT mapping level")
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 66a644c0
......@@ -4335,7 +4335,7 @@ static u8 kvm_max_private_mapping_level(struct kvm *kvm, kvm_pfn_t pfn,
if (req_max_level)
max_level = min(max_level, req_max_level);
return req_max_level;
return max_level;
}
static int kvm_faultin_pfn_private(struct kvm_vcpu *vcpu,
......
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