kaiser: kaiser_remove_mapping() move along the pgd
When removing the bogus comment from kaiser_remove_mapping(), I really ought to have checked the extent of its bogosity: as Neel points out, there is nothing to stop unmap_pud_range_nofree() from continuing beyond the end of a pud (and starting in the wrong position on the next). Fix kaiser_remove_mapping() to constrain the extent and advance pgd pointer correctly: use pgd_addr_end() macro as used throughout base mm (but don't assume page-rounded start and size in this case). But this bug was very unlikely to trigger in this backport: since any buddy allocation is contained within a single pud extent, and we are not using vmapped stacks (and are only mapping one page of stack anyway): the only way to hit this bug here would be when freeing a large modified ldt. Signed-off-by: Hugh Dickins <hughd@google.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0c68228f7b
commit
f127705d26
1 changed files with 6 additions and 4 deletions
|
@ -297,11 +297,13 @@ void kaiser_remove_mapping(unsigned long start, unsigned long size)
|
||||||
extern void unmap_pud_range_nofree(pgd_t *pgd,
|
extern void unmap_pud_range_nofree(pgd_t *pgd,
|
||||||
unsigned long start, unsigned long end);
|
unsigned long start, unsigned long end);
|
||||||
unsigned long end = start + size;
|
unsigned long end = start + size;
|
||||||
unsigned long addr;
|
unsigned long addr, next;
|
||||||
|
pgd_t *pgd;
|
||||||
|
|
||||||
for (addr = start; addr < end; addr += PGDIR_SIZE) {
|
pgd = native_get_shadow_pgd(pgd_offset_k(start));
|
||||||
pgd_t *pgd = native_get_shadow_pgd(pgd_offset_k(addr));
|
for (addr = start; addr < end; pgd++, addr = next) {
|
||||||
unmap_pud_range_nofree(pgd, addr, end);
|
next = pgd_addr_end(addr, end);
|
||||||
|
unmap_pud_range_nofree(pgd, addr, next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue