aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLijun Ou <oulijun@huawei.com>2016-09-20 12:07:08 -0400
committerDoug Ledford <dledford@redhat.com>2016-10-03 11:43:15 -0400
commit24f0c9c0ff0955c5849dfb40403a21c8c11b9d2a (patch)
treefa88fe71f5e431defb047c93b22dc3a5445f7345
parentcb814642e7e3e67f6a7c24b14531e95ccdb7c3cc (diff)
IB/hns: Cq has not been freed
Cq has not been freed when fail to ib_copy_to_udata, so need to free it. Signed-off-by: Lijun Ou <oulijun@huawei.com> Signed-off-by: Peter Chen <luck.chen@huawei.com> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_cq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
index 3095f06099e6..097365932b09 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
@@ -357,12 +357,15 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev,
357 if (context) { 357 if (context) {
358 if (ib_copy_to_udata(udata, &hr_cq->cqn, sizeof(u64))) { 358 if (ib_copy_to_udata(udata, &hr_cq->cqn, sizeof(u64))) {
359 ret = -EFAULT; 359 ret = -EFAULT;
360 goto err_mtt; 360 goto err_cqc;
361 } 361 }
362 } 362 }
363 363
364 return &hr_cq->ib_cq; 364 return &hr_cq->ib_cq;
365 365
366err_cqc:
367 hns_roce_free_cq(hr_dev, hr_cq);
368
366err_mtt: 369err_mtt:
367 hns_roce_mtt_cleanup(hr_dev, &hr_cq->hr_buf.hr_mtt); 370 hns_roce_mtt_cleanup(hr_dev, &hr_cq->hr_buf.hr_mtt);
368 if (context) 371 if (context)