Commit 89e09350 authored by Chengchang Tang's avatar Chengchang Tang
Browse files

RDMA/hns: Fix new mmaped pages during resetting

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

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

All mmaped pages need to be zapped after resetting to avoid a
PUAF. Currently, pages mmaped during reset phase may be left,
so avoid mmaping new pages when reset happened.

The complete official user space reset solution is accepted by
mainline 6.13. There are certain differences between the current
version implementation on OLK-6.6 and mainline 6.13. And these
two are KABI incompatible. Considering the openeuler KABI
strategy, the mainline patch cannot be directly backport to
OLK-6.6. In order to solve some potential problems, this patch
merges the mainline patch with the current patch on OLK-6.6 to
ensure that the overall solution is basically consistent with
the mainline.

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



Fixes: 813b1ee7 ("RDMA/hns: Fix missing resetting notify")
Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 30113d28
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -683,6 +683,11 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
	pgprot_t prot;
	int ret;

	if (hr_dev->dis_db) {
		atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MMAP_ERR_CNT]);
		return -EPERM;
	}

	rdma_entry = rdma_user_mmap_entry_get_pgoff(uctx, vma->vm_pgoff);
	if (!rdma_entry) {
		atomic64_inc(&hr_dev->dfx_cnt[HNS_ROCE_DFX_MMAP_ERR_CNT]);