lkml.org 
[lkml]   [2015]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.1 217/267] RDMA/ocrdma: fix double free on pd
    Date
    4.1-stable review patch.  If anyone has any objections, please let me know.

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

    From: Colin Ian King <colin.king@canonical.com>

    commit 4dc544427991e3cef38ce3ae124b7e6557063bd3 upstream.

    A reorganisation of the PD allocation and deallocation in commit
    9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
    introduced a double free on pd, as detected by static analysis by
    smatch:

    drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:682 ocrdma_alloc_pd()
    error: double free of 'pd'^

    The original call to ocrdma_mbx_dealloc_pd() (which does not kfree
    pd) was replaced with a call to _ocrdma_dealloc_pd() (which does
    kfree pd). The kfree following this call causes the double free,
    so just remove it to fix the problem.

    Fixes: 9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Acked-By: Devesh Sharma <devesh.sharma@avagotech.com>
    Signed-off-by: Doug Ledford <dledford@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 1 -
    1 file changed, 1 deletion(-)

    --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
    +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
    @@ -679,7 +679,6 @@ err:
    ocrdma_release_ucontext_pd(uctx);
    } else {
    status = _ocrdma_dealloc_pd(dev, pd);
    - kfree(pd);
    }
    exit:
    return ERR_PTR(status);



    \
     
     \ /
      Last update: 2015-07-31 23:41    [W:2.477 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site