Skip to content

Commit 13c90c2

Browse files
Junxian Huangrleon
authored andcommitted
RDMA/hns: Fix invalid sq params not being blocked
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, although the check result of kernel sq params will not be overwritten, to keep coding style unified, move default_congest_type() before set_kernel_sq_size(). Fixes: 6ec429d ("RDMA/hns: Support userspace configuring congestion control algorithm with QP granularity") Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://patch.msgid.link/20250311084857.3803665-5-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent b9f59a2 commit 13c90c2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/infiniband/hw/hns/hns_roce_qp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,24 +1121,23 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
11211121
ibucontext);
11221122
hr_qp->config = uctx->config;
11231123
ret = set_user_sq_size(hr_dev, &init_attr->cap, hr_qp, ucmd);
1124-
if (ret)
1124+
if (ret) {
11251125
ibdev_err(ibdev,
11261126
"failed to set user SQ size, ret = %d.\n",
11271127
ret);
1128+
return ret;
1129+
}
11281130

11291131
ret = set_congest_param(hr_dev, hr_qp, ucmd);
1130-
if (ret)
1131-
return ret;
11321132
} else {
11331133
if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
11341134
hr_qp->config = HNS_ROCE_EXSGE_FLAGS;
1135+
default_congest_type(hr_dev, hr_qp);
11351136
ret = set_kernel_sq_size(hr_dev, &init_attr->cap, hr_qp);
11361137
if (ret)
11371138
ibdev_err(ibdev,
11381139
"failed to set kernel SQ size, ret = %d.\n",
11391140
ret);
1140-
1141-
default_congest_type(hr_dev, hr_qp);
11421141
}
11431142

11441143
return ret;

0 commit comments

Comments
 (0)