Account for the case where memslot size is largepage aligned, but does not
start on largepage aligned offset.
Otherwise it allocates one lpage_info struct less than what the memslot
spans, possibly resulting in memory corruption.
Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]>
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3396a5f..93ed78b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -347,6 +347,9 @@ int __kvm_set_memory_region(struct kvm *kvm,
int largepages = npages / KVM_PAGES_PER_HPAGE;
if (npages % KVM_PAGES_PER_HPAGE)
largepages++;
+ if (base_gfn % KVM_PAGES_PER_HPAGE)
+ largepages++;
+
new.lpage_info = vmalloc(largepages * sizeof(*new.lpage_info));
if (!new.lpage_info)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel