Skip to content
Snippets Groups Projects
Commit df467e5d authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov
Browse files

KVM: x86: Use __vcalloc() in kvm_page_track_write_tracking_alloc()

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2119111



commit 37b2a651
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Tue Mar 8 04:49:37 2022 -0500

    KVM: use __vcalloc for very large allocations

    Allocations whose size is related to the memslot size can be arbitrarily
    large.  Do not use kvzalloc/kvcalloc, as those are limited to "not crazy"
    sizes that fit in 32 bits.

    Cc: stable@vger.kernel.org
    Fixes: 7661809d ("mm: don't allow oversized kvmalloc() calls")
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>

RHEL-only: Upstream commit 37b2a651 ("KVM: use __vcalloc for very
large allocations") was previously backported without the hunk which
goes to kvm_page_track_write_tracking_alloc().

Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
parent c56f63c6
No related merge requests found
......@@ -75,7 +75,8 @@ int kvm_page_track_write_tracking_alloc(struct kvm_memory_slot *slot)
if (slot->arch.gfn_track[KVM_PAGE_TRACK_WRITE])
return 0;
gfn_track = kvcalloc(slot->npages, sizeof(*gfn_track), GFP_KERNEL_ACCOUNT);
gfn_track = __vcalloc(slot->npages, sizeof(*gfn_track),
GFP_KERNEL_ACCOUNT);
if (gfn_track == NULL)
return -ENOMEM;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment