lkml.org 
[lkml]   [2011]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[075/244] drm/nouveau: properly handle allocation failure in nouveau_sgdma_populate
    3.0-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Marcin Slusarz <marcin.slusarz@gmail.com>

    commit 17c8b960930da3599e47801a54ac0ea1070545d2 upstream.

    Not cleaning after alloc failure would result in crash on destroy,
    because nouveau_sgdma_clear assumes "ttm_alloced" to be not null when
    "pages" is not null.

    Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/gpu/drm/nouveau/nouveau_sgdma.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
    +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
    @@ -37,8 +37,11 @@ nouveau_sgdma_populate(struct ttm_backen
    return -ENOMEM;

    nvbe->ttm_alloced = kmalloc(sizeof(bool) * num_pages, GFP_KERNEL);
    - if (!nvbe->ttm_alloced)
    + if (!nvbe->ttm_alloced) {
    + kfree(nvbe->pages);
    + nvbe->pages = NULL;
    return -ENOMEM;
    + }

    nvbe->nr_pages = 0;
    while (num_pages--) {



    \
     
     \ /
      Last update: 2011-09-29 01:07    [W:3.445 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site