Commit 6ce1b826 authored by David Mosberger's avatar David Mosberger Committed by Linus Torvalds

[PATCH] nasty bug in free_pgtables() (for ia64)

Strictly speaking, this patch is needed only for arches which use
discontiguous virtual address bits for the PGD index.

When we originally worked on this code (~ 2 years ago or so, in
response to a bug report & patch from an Intel guy), I had myself
convinced that the code is correct, but of course I missed the fact
that:

	pgd_index(first) < pgd_index(last)

does NOT imply that:

	first < last

For example, with a 16KB page size on ia64, we might end up with:

   first = 6000100f80003fff => first_idx = 0x300
   last  = 60000fffffff8000 =>  last_idx = 0x3ff

Note here that first_idx < last_idx even though first > last.  This is
because pgd_index() ignores bits 44..60.

I suppose we could put the extra check inside #ifdef __ia64__, but
that would be rather ugly and would really mean that Linux does not
support discontiguous PGD indices.
parent b5c8a738
......@@ -781,6 +781,8 @@ static void free_pgtables(mmu_gather_t *tlb, struct vm_area_struct *prev,
break;
}
no_mmaps:
if (last < first) /* needed for arches with discontiguous pgd indices */
return;
/*
* If the PGD bits are not consecutive in the virtual address, the
* old method of shifting the VA >> by PGDIR_SHIFT doesn't work.
......
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