Skip to content

Commit 4ddc920

Browse files
xzpeterbonzini
authored andcommitted
KVM: Fix the bitmap range to copy during clear dirty
kvm_dirty_bitmap_bytes() will return the size of the dirty bitmap of the memslot rather than the size of bitmap passed over from the ioctl. Here for KVM_CLEAR_DIRTY_LOG we should only copy exactly the size of bitmap that covers kvm_clear_dirty_log.num_pages. Signed-off-by: Peter Xu <peterx@redhat.com> Cc: stable@vger.kernel.org Fixes: 2a31b9d Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent e9c16c7 commit 4ddc920

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎virt/kvm/kvm_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
12511251
if (!dirty_bitmap)
12521252
return -ENOENT;
12531253

1254-
n = kvm_dirty_bitmap_bytes(memslot);
1254+
n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
12551255

12561256
if (log->first_page > memslot->npages ||
12571257
log->num_pages > memslot->npages - log->first_page ||

0 commit comments

Comments
 (0)