From: Lijun Fang fanglijun3@huawei.com
ascend inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4DZYE CVE: NA
---------------------------
svm_mmap use the pgoff flag for the security requirement nid, which used as cdm node.
Signed-off-by: Lijun Fang fanglijun3@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/char/svm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/char/svm.c b/drivers/char/svm.c index f312b7e02263c..62092fbaa0104 100644 --- a/drivers/char/svm.c +++ b/drivers/char/svm.c @@ -1820,9 +1820,17 @@ static int svm_mmap(struct file *file, struct vm_area_struct *vma) if ((vma->vm_end < vma->vm_start) || (vm_size > MMAP_PHY32_MAX)) return -EINVAL;
- page = alloc_pages(GFP_KERNEL | GFP_DMA32, get_order(vm_size)); + /* vma->vm_pgoff transfer the nid */ + if (vma->vm_pgoff == 0) + page = alloc_pages(GFP_KERNEL | GFP_DMA32, + get_order(vm_size)); + else + page = alloc_pages_node((int)vma->vm_pgoff, + GFP_KERNEL | __GFP_THISNODE, + get_order(vm_size)); if (!page) { - dev_err(sdev->dev, "fail to alloc page\n"); + dev_err(sdev->dev, "fail to alloc page on node 0x%lx\n", + vma->vm_pgoff); return -ENOMEM; }