OSDN Git Service

RDMA/uverbs: Don't do double free of allocated PD
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 13 Feb 2019 17:07:05 +0000 (19:07 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 25 Feb 2019 22:00:48 +0000 (15:00 -0700)
There is no need to call kfree(pd) because ib_dealloc_pd() internally
frees PD.

Fixes: 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/uverbs_cmd.c

index 3128821..062a86c 100644 (file)
@@ -440,6 +440,7 @@ static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs)
 
 err_copy:
        ib_dealloc_pd(pd);
+       pd = NULL;
 err_alloc:
        kfree(pd);
 err: