mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
KVM: x86: Fix host_mapping_level()
commit 82b7005f0e upstream.
When found a error hva, should not return PAGE_SIZE but the level...
Also clean up the coding style of the following loop.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
493821093f
commit
0118bac217
@@ -477,7 +477,7 @@ static int host_mapping_level(struct kvm *kvm, gfn_t gfn)
|
||||
|
||||
addr = gfn_to_hva(kvm, gfn);
|
||||
if (kvm_is_error_hva(addr))
|
||||
return page_size;
|
||||
return PT_PAGE_TABLE_LEVEL;
|
||||
|
||||
down_read(¤t->mm->mmap_sem);
|
||||
vma = find_vma(current->mm, addr);
|
||||
@@ -515,11 +515,9 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
|
||||
if (host_level == PT_PAGE_TABLE_LEVEL)
|
||||
return host_level;
|
||||
|
||||
for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level) {
|
||||
|
||||
for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level)
|
||||
if (has_wrprotected_page(vcpu->kvm, large_gfn, level))
|
||||
break;
|
||||
}
|
||||
|
||||
return level - 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user