[PATCH] RDMA/ocrdma: Fix double free in ocrdma_alloc_pd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
Compile tested only. Applies against linux-next.
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux