lkml.org 
[lkml]   [2006]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 8/8] KVM: Fix oops on oom
    From
    Date
    __free_page() doesn't like a NULL argument, so check before calling it.  A
    NULL can only happen if memory is exhausted during allocation of a memory
    slot.

    Signed-off-by: Avi Kivity <avi@qumranet.com>

    Index: linux-2.6/drivers/kvm/kvm_main.c
    ===================================================================
    --- linux-2.6.orig/drivers/kvm/kvm_main.c
    +++ linux-2.6/drivers/kvm/kvm_main.c
    @@ -245,7 +245,8 @@ static void kvm_free_physmem_slot(struct
    if (!dont || free->phys_mem != dont->phys_mem)
    if (free->phys_mem) {
    for (i = 0; i < free->npages; ++i)
    - __free_page(free->phys_mem[i]);
    + if (free->phys_mem[i])
    + __free_page(free->phys_mem[i]);
    vfree(free->phys_mem);
    }

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2006-12-28 11:17    [W:0.019 / U:29.324 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site