提交 4aea578a 编写于 作者: W Wenpeng Liang 提交者: Zheng Zengkai

RDMA/hns: Add verification of QP type when post_recv

mainline inclusion
from mainline-v5.12-rc1
commit 204cbe42
category: bugfix
bugzilla: 174002
CVE:NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=204cbe423b6ea8368eaa17b0c42542dc4f719c1f

----------------------------------------------------------------------

The post_recv only supports QP types of RC, GSI and UD.

Link: https://lore.kernel.org/r/1611997090-48820-13-git-send-email-liweihang@huawei.comSigned-off-by: NWenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: NWeihang Li <liweihang@huawei.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nwangsirong <wangsirong@huawei.com>
Reviewed-by: NChunZhi Hu <huchunzhi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 6dfc97ff
......@@ -720,9 +720,21 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
static int check_recv_valid(struct hns_roce_dev *hr_dev,
struct hns_roce_qp *hr_qp)
{
struct ib_device *ibdev = &hr_dev->ib_dev;
struct ib_qp *ibqp = &hr_qp->ibqp;
if (unlikely(ibqp->qp_type != IB_QPT_RC &&
ibqp->qp_type != IB_QPT_GSI &&
ibqp->qp_type != IB_QPT_UD)) {
ibdev_err(ibdev, "unsupported qp type, qp_type = %d.\n",
ibqp->qp_type);
return -EOPNOTSUPP;
}
if (unlikely(hr_dev->state >= HNS_ROCE_DEVICE_STATE_RST_DOWN))
return -EIO;
else if (hr_qp->state == IB_QPS_RESET)
if (hr_qp->state == IB_QPS_RESET)
return -EINVAL;
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册