diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/mm/memory.c b/mm/memory.c index 119b7ccdf39b..bde42c6d3633 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1394,10 +1394,20 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1394 | return i ? : -EFAULT; | 1394 | return i ? : -EFAULT; |
1395 | } | 1395 | } |
1396 | if (pages) { | 1396 | if (pages) { |
1397 | struct page *page = vm_normal_page(gate_vma, start, *pte); | 1397 | struct page *page; |
1398 | |||
1399 | page = vm_normal_page(gate_vma, start, *pte); | ||
1400 | if (!page) { | ||
1401 | if (!(gup_flags & FOLL_DUMP) && | ||
1402 | is_zero_pfn(pte_pfn(*pte))) | ||
1403 | page = pte_page(*pte); | ||
1404 | else { | ||
1405 | pte_unmap(pte); | ||
1406 | return i ? : -EFAULT; | ||
1407 | } | ||
1408 | } | ||
1398 | pages[i] = page; | 1409 | pages[i] = page; |
1399 | if (page) | 1410 | get_page(page); |
1400 | get_page(page); | ||
1401 | } | 1411 | } |
1402 | pte_unmap(pte); | 1412 | pte_unmap(pte); |
1403 | if (vmas) | 1413 | if (vmas) |