• Tejun Heo's avatar
    percpu: fix pcpu_alloc_pages() failure path · a3079e43
    Tejun Heo authored
    commit f0d27965 upstream.
    
    When pcpu_alloc_pages() fails midway, pcpu_free_pages() is invoked to
    free what has already been allocated.  The invocation is across the
    whole requested range and pcpu_free_pages() will try to free all
    non-NULL pages; unfortunately, this is incorrect as
    pcpu_get_pages_and_bitmap(), unlike what its comment suggests, doesn't
    clear the pages array and thus the array may have entries from the
    previous invocations making the partial failure path free incorrect
    pages.
    
    Fix it by open-coding the partial freeing of the already allocated
    pages.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    a3079e43
percpu-vm.c 13.1 KB