aboutsummaryrefslogtreecommitdiff
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-14 23:10:00 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-14 23:10:00 -0400
commit4c0e176dd5e4c44dd60f398518f75eedbe1a65f3 (patch)
tree07aea7539f78f221c6fc535a94a07befa2afdb63 /mm/hugetlb.c
parentf241be74b803dcf9d70c9978292946370654320f (diff)
parent2ba84684e8cf6f980e4e95a2300f53a505eb794e (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index fbd1111ea11..6bf720bc662 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -301,6 +301,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
{
struct mm_struct *mm = vma->vm_mm;
unsigned long address;
+ pte_t *ptep;
pte_t pte;
struct page *page;
@@ -309,9 +310,17 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
BUG_ON(end & ~HPAGE_MASK);
for (address = start; address < end; address += HPAGE_SIZE) {
- pte = huge_ptep_get_and_clear(mm, address, huge_pte_offset(mm, address));
+ ptep = huge_pte_offset(mm, address);
+ if (! ptep)
+ /* This can happen on truncate, or if an
+ * mmap() is aborted due to an error before
+ * the prefault */
+ continue;
+
+ pte = huge_ptep_get_and_clear(mm, address, ptep);
if (pte_none(pte))
continue;
+
page = pte_page(pte);
put_page(page);
}