diff mbox

RDMA/ocrdma: Fix double free in ocrdma_alloc_pd()

Message ID 1424734325-24310-1-git-send-email-cengelma@gmx.at (mailing list archive)
State Rejected
Headers show

Commit Message

Christian Engelmayer Feb. 23, 2015, 11:32 p.m. UTC
Commit 9ba1377daa51 ("RDMA/ocrdma: Move PD resource management to driver.")
modified the err exit path in function ocrdma_alloc_pd() so that a call of
_ocrdma_dealloc_pd(dev, pd) is followed by kfree(pd). However,
_ocrdma_dealloc_pd() already unconditionally frees argument pd. Thus remove
the double free. Detected by Coverity CID 1271296.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
---
Compile tested only. Applies against linux-next.
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 877175563634..74219d288aea 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -675,12 +675,10 @@  pd_mapping:
 	return &pd->ibpd;
 
 err:
-	if (is_uctx_pd) {
+	if (is_uctx_pd)
 		ocrdma_release_ucontext_pd(uctx);
-	} else {
+	else
 		status = _ocrdma_dealloc_pd(dev, pd);
-		kfree(pd);
-	}
 exit:
 	return ERR_PTR(status);
 }