[PATCH for-rc 2/8] RDMA/hns: Bugfix for exception of creating srq

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

 



It needs to copy the driver data to the user when creating srq.
if copy fail, it need to free the srq resource that have allocated
by hns_roce_srq_alloc function.

This patch depends on the patch("[PATCH V3 for-next] RDMA/hns: Update the kernel header file of hns")

Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
---
 drivers/infiniband/hw/hns/hns_roce_srq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
index a934511..12deacf 100644
--- a/drivers/infiniband/hw/hns/hns_roce_srq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
@@ -385,12 +385,15 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd,
 		if (ib_copy_to_udata(udata, &resp,
 				     min(udata->outlen, sizeof(resp)))) {
 			ret = -EFAULT;
-			goto err_wrid;
+			goto err_srqc_alloc;
 		}
 	}
 
 	return &srq->ibsrq;
 
+err_srqc_alloc:
+	hns_roce_srq_free(hr_dev, srq);
+
 err_wrid:
 	kvfree(srq->wrid);
 
-- 
1.9.1




[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