Commit d3729802 authored by Chengchang Tang's avatar Chengchang Tang Committed by li-huisong
Browse files

RDMA/hns: Fix warning storm caused by invalid input in IO path

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBDW6Z
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?id=fa5c4ba8cdbfd2c2d6422e001311c8213283ebbf



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

WARN_ON() is called in the IO path. And it could lead to a warning
storm. Use WARN_ON_ONCE() instead of WARN_ON().

Fixes: 12542f1d ("RDMA/hns: Refactor process about opcode in post_send()")
Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20241220055249.146943-4-huangjunxian6@hisilicon.com


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 2e3913b6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp,
	valid_num_sge = calc_wr_sge_num(wr, &msg_len);

	ret = set_ud_opcode(ud_sq_wqe, wr);
	if (WARN_ON(ret))
	if (WARN_ON_ONCE(ret))
		return ret;

	ud_sq_wqe->msg_len = cpu_to_le32(msg_len);
@@ -670,7 +670,7 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
	rc_sq_wqe->msg_len = cpu_to_le32(msg_len);

	ret = set_rc_opcode(hr_dev, rc_sq_wqe, wr);
	if (WARN_ON(ret))
	if (WARN_ON_ONCE(ret))
		return ret;

	hr_reg_write(rc_sq_wqe, RC_SEND_WQE_SO,