Skip to content

Commit

Permalink
KVM: x86/mmu: fix determination of max NPT mapping level for private …
Browse files Browse the repository at this point in the history
…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: Ackerley Tng <[email protected]>
Message-ID: <[email protected]>
Fixes: f32fb32 ("KVM: x86: Add hook for determining max NPT mapping level")
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Ackerley Tng authored and bonzini committed Aug 1, 2024
1 parent 66a644c commit aca0ec9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kvm/mmu/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit aca0ec9

Please sign in to comment.