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=615...
Fixes: 813b1ee74ff3 ("RDMA/hns: Fix missing resetting notify") Signed-off-by: Chengchang Tang tangchengchang@huawei.com Signed-off-by: Junxian Huang huangjunxian6@hisilicon.com Signed-off-by: Xinghai Cen cenxinghai@h-partners.com --- drivers/infiniband/hw/hns/hns_roce_main.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index b637424f0a51..1302c58c3937 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -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]); -- 2.33.0