From: liubo liubo254@huaewi.com
euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I7U78A CVE: NA
------------------------------------------------
only shared page mapped by multi process cannot specify the swap area
Signed-off-by: liubo liubo254@huaewi.com --- mm/swap_slots.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 79a3164bf393..91a5057cb097 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -321,10 +321,6 @@ static bool has_preferred_swap(struct page *page, struct vm_area_struct *vma, *si = ERR_PTR(-EPERM); return false; } - if (vma->vm_file) { - *si = ERR_PTR(-EPERM); - return false; - } if (vma->vm_mm->preferred_swap) { *si = vma->vm_mm->preferred_swap; } else { @@ -358,7 +354,7 @@ swp_entry_t get_swap_page(struct page *page) #ifdef CONFIG_PREFERRED_SWAP struct swap_info_struct *preferred_swap = NULL;
- if (!page_mapping(page)) + if (page_mapcount(page) <= 1) preferred_swap = page_preferred_swap(page); #endif