Commit 12b014bd authored by Peter Xu's avatar Peter Xu Committed by Greg Kroah-Hartman

KVM: Fix the bitmap range to copy during clear dirty

commit 4ddc9204 upstream.

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: default avatarPeter Xu <peterx@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 2a31b9dbSigned-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f6ef23f
...@@ -1250,7 +1250,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm, ...@@ -1250,7 +1250,7 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
if (!dirty_bitmap) if (!dirty_bitmap)
return -ENOENT; return -ENOENT;
n = kvm_dirty_bitmap_bytes(memslot); n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
if (log->first_page > memslot->npages || if (log->first_page > memslot->npages ||
log->num_pages > memslot->npages - log->first_page || log->num_pages > memslot->npages - log->first_page ||
......
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