Commit 3e2b4d4e authored by Junxian Huang's avatar Junxian Huang
Browse files

RDMA/hns: Fix invalid sq params not being blocked

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBSE4C



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

SQ params from userspace are checked in by set_user_sq_size(). But
when the check fails, the function doesn't return but instead keep
running and overwrite 'ret'. As a result, the invalid params will
not get blocked actually.

Add a return right after the failed check. Besides, to keep coding
style unified, move default_congest_type() before set_kernel_sq_size().

Fixes: 7a5b9459 ("RDMA/hns: Fix congestions control algorithm type for UD")
Fixes: 09f1b7cb ("RDMA/hns: Support congestion control algorithm configuration at QP granularity")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent ac0aa20d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1326,17 +1326,17 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
						ibucontext);
		hr_qp->config = uctx->config;
		ret = set_user_sq_size(hr_dev, &init_attr->cap, hr_qp, ucmd);
		if (ret)
		if (ret) {
			ibdev_err(ibdev, "Failed to set user SQ size, ret = %d\n",
				  ret);
			return ret;
		}

		ret = set_uqp_create_flag_param(hr_dev, hr_qp, init_attr, ucmd);
		if (ret)
			return ret;

		ret = set_congest_param(hr_dev, hr_qp, ucmd);
		if (ret)
			return ret;
	} else {
		if (init_attr->create_flags &
		    IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) {