• Douglas Gilbert's avatar
    sgl_alloc_order: fix memory leak · b2a182a4
    Douglas Gilbert authored
    sgl_alloc_order() can fail when 'length' is large on a memory
    constrained system. When order > 0 it will potentially be
    making several multi-page allocations with the later ones more
    likely to fail than the earlier one. So it is important that
    sgl_alloc_order() frees up any pages it has obtained before
    returning NULL. In the case when order > 0 it calls the wrong
    free page function and leaks. In testing the leak was
    sufficient to bring down my 8 GiB laptop with OOM.
    Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
    Signed-off-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    b2a182a4
scatterlist.c 25.2 KB