提交 91d8442c 编写于 作者: O oulijun 提交者: Xie XiuQi

RDMA/hns: Bugfix for creating qp attached to srq

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

When create a qp and attached to srq, rq will no longer be used
and the members of rq will be set zero. As a result, the wrid
of rq will not be allocated and used.

Fixes: 172d424d2b86 ("RDMA/hns: Add QP operations support for hip08 SoC")

Feature or Bugfix:Bugfix
Signed-off-by: Noulijun <oulijun@huawei.com>
Reviewed-by: Nliyangyang20 <liyangyang20@huawei.com>
Reviewed-by: Nliuyixian <liuyixian@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 01635695
......@@ -967,11 +967,18 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
hr_qp->sq.wrid = kcalloc(hr_qp->sq.wqe_cnt, sizeof(u64),
GFP_KERNEL);
if (ZERO_OR_NULL_PTR(hr_qp->sq.wrid)) {
ret = -ENOMEM;
goto err_get_bufs;
}
if (hr_qp->rq.wqe_cnt) {
hr_qp->rq.wrid = kcalloc(hr_qp->rq.wqe_cnt, sizeof(u64),
GFP_KERNEL);
if (!hr_qp->sq.wrid || !hr_qp->rq.wrid) {
if (ZERO_OR_NULL_PTR(hr_qp->rq.wrid)) {
ret = -ENOMEM;
goto err_wrid;
goto err_sq_wrid;
}
}
}
......@@ -1060,7 +1067,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
to_hr_ucontext(ib_pd->uobject->context),
&hr_qp->rdb);
} else {
kfree(hr_qp->sq.wrid);
if (hr_qp->rq.wqe_cnt)
kfree(hr_qp->rq.wrid);
}
......@@ -1073,6 +1080,9 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
hns_roce_db_unmap_user(
to_hr_ucontext(ib_pd->uobject->context),
&hr_qp->sdb);
err_sq_wrid:
if (!ib_pd->uobject)
kfree(hr_qp->sq.wrid);
err_get_bufs:
hns_roce_free_buf_list(buf_list, hr_qp->region_cnt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册