Commit e7a88057 authored by Andrew Morton's avatar Andrew Morton Committed by James Bottomley

[PATCH] Fix copy_page_range()'s handling of invalid pages

Patch from Xavier Bru  <Xavier.Bru@bull.net>

If copy_page_range encounters a pte which maps an invalid pageframe it will
proceed to try to add an rmap entry against that page.  This causes oopses
when an application which has mapped an IO device via /dev/mem forks.

Fix that up by correctly skipping the page_add_rmap() for these pte's.
parent 9f930d75
......@@ -286,9 +286,16 @@ skip_copy_pmd_range: address = (address + PGDIR_SIZE) & PGDIR_MASK;
goto cont_copy_pte_range_noset;
}
pfn = pte_pfn(pte);
/* the pte points outside of valid memory, the
* mapping is assumed to be good, meaningful
* and not mapped via rmap - duplicate the
* mapping as is.
*/
if (!pfn_valid(pfn)) {
set_pte(dst_pte, pte);
goto cont_copy_pte_range_noset;
}
page = pfn_to_page(pfn);
if (!pfn_valid(pfn))
goto cont_copy_pte_range;
if (PageReserved(page))
goto cont_copy_pte_range;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment