Patch from Xavier Bru 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. mm/memory.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff -puN mm/memory.c~copy_page_range-invalid-page-fix mm/memory.c --- 25/mm/memory.c~copy_page_range-invalid-page-fix 2003-03-05 10:44:11.000000000 -0800 +++ 25-akpm/mm/memory.c 2003-03-05 10:44:11.000000000 -0800 @@ -286,9 +286,16 @@ skip_copy_pte_range: 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; _