Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98276
b: refs/heads/master
c: 89f5b7d
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jun 20, 2008
1 parent 73b6ce5 commit ed78c56
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9bedbcb207ed9a571b239231d99c8fd4a34ae24d
refs/heads/master: 89f5b7da2a6bad2e84670422ab8192382a5aeb9f
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/kernel/vdso.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void dump_one_vdso_page(struct page *pg, struct page *upg)
printk("kpg: %p (c:%d,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT),
page_count(pg),
pg->flags);
if (upg/* && pg != upg*/) {
if (upg && !IS_ERR(upg) /* && pg != upg*/) {
printk(" upg: %p (c:%d,f:%08lx)", __va(page_to_pfn(upg)
<< PAGE_SHIFT),
page_count(upg),
Expand Down
17 changes: 13 additions & 4 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,17 +999,15 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
goto no_page_table;

ptep = pte_offset_map_lock(mm, pmd, address, &ptl);
if (!ptep)
goto out;

pte = *ptep;
if (!pte_present(pte))
goto unlock;
goto no_page;
if ((flags & FOLL_WRITE) && !pte_write(pte))
goto unlock;
page = vm_normal_page(vma, address, pte);
if (unlikely(!page))
goto unlock;
goto bad_page;

if (flags & FOLL_GET)
get_page(page);
Expand All @@ -1024,6 +1022,15 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
out:
return page;

bad_page:
pte_unmap_unlock(ptep, ptl);
return ERR_PTR(-EFAULT);

no_page:
pte_unmap_unlock(ptep, ptl);
if (!pte_none(pte))
return page;
/* Fall through to ZERO_PAGE handling */
no_page_table:
/*
* When core dumping an enormous anonymous area that nobody
Expand Down Expand Up @@ -1159,6 +1166,8 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,

cond_resched();
}
if (IS_ERR(page))
return i ? i : PTR_ERR(page);
if (pages) {
pages[i] = page;

Expand Down
10 changes: 10 additions & 0 deletions trunk/mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,11 @@ static int do_move_pages(struct mm_struct *mm, struct page_to_node *pm,
goto set_status;

page = follow_page(vma, pp->addr, FOLL_GET);

err = PTR_ERR(page);
if (IS_ERR(page))
goto set_status;

err = -ENOENT;
if (!page)
goto set_status;
Expand Down Expand Up @@ -928,6 +933,11 @@ static int do_pages_stat(struct mm_struct *mm, struct page_to_node *pm)
goto set_status;

page = follow_page(vma, pm->addr, 0);

err = PTR_ERR(page);
if (IS_ERR(page))
goto set_status;

err = -ENOENT;
/* Use PageReserved to check for zero page */
if (!page || PageReserved(page))
Expand Down

0 comments on commit ed78c56

Please sign in to comment.