Commit 5b1f9a56 authored by Juan Zhou's avatar Juan Zhou
Browse files

RDMA/hns: Fix missing parameter check in set_write_notify_param()

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



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

Add parameter check in set_write_notify_param().

Fixes: 21cacb51 ("RDMA/hns: Support write with notify")
Signed-off-by: default avatarJuan Zhou <zhoujuan51@h-partners.com>
Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
parent f6916e6d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -392,6 +392,9 @@ static int set_write_notify_param(struct hns_roce_dev *hr_dev,
			       notify_attr[attr].mem_type))
		return -EOPNOTSUPP;

	if (!hr_dev->notify_tbl || ucmd->notify_idx >= hr_dev->notify_num)
		return -EINVAL;

	hr_cq->flags |= HNS_ROCE_CQ_FLAG_NOTIFY_EN;
	hr_cq->write_notify.notify_addr =
		hr_dev->notify_tbl[ucmd->notify_idx].base_addr;