Message ID | 20200214005929.104481-1-arjunroy.kdev@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [mm,next-next] Add missing page_count() check to vm_insert_pages(). | expand |
diff --git a/mm/memory.c b/mm/memory.c index f1d5f2264aef..3b4007a6ef7f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1463,8 +1463,11 @@ static int insert_page_into_pte_locked(struct mm_struct *mm, pte_t *pte, static int insert_page_in_batch_locked(struct mm_struct *mm, pmd_t *pmd, unsigned long addr, struct page *page, pgprot_t prot) { - const int err = validate_page_before_insert(page); + int err; + if (!page_count(page)) + return -EINVAL; + err = validate_page_before_insert(page); return err ? err : insert_page_into_pte_locked( mm, pte_offset_map(pmd, addr), addr, page, prot); }