diff options
-rw-r--r-- | mm/memory.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index 4e1c673784db..2405289dfdf8 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -910,9 +910,13 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
910 | pud = pud_offset(pgd, pg); | 910 | pud = pud_offset(pgd, pg); |
911 | BUG_ON(pud_none(*pud)); | 911 | BUG_ON(pud_none(*pud)); |
912 | pmd = pmd_offset(pud, pg); | 912 | pmd = pmd_offset(pud, pg); |
913 | BUG_ON(pmd_none(*pmd)); | 913 | if (pmd_none(*pmd)) |
914 | return i ? : -EFAULT; | ||
914 | pte = pte_offset_map(pmd, pg); | 915 | pte = pte_offset_map(pmd, pg); |
915 | BUG_ON(pte_none(*pte)); | 916 | if (pte_none(*pte)) { |
917 | pte_unmap(pte); | ||
918 | return i ? : -EFAULT; | ||
919 | } | ||
916 | if (pages) { | 920 | if (pages) { |
917 | pages[i] = pte_page(*pte); | 921 | pages[i] = pte_page(*pte); |
918 | get_page(pages[i]); | 922 | get_page(pages[i]); |