mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [ZVC 1/4] Fix potential use of out of range page in kmem_getpages.
@ 2006-06-27 17:45 Christoph Lameter
  2006-06-27 17:45 ` [ZVC 2/4] highmem.c: Use page after it may have been freed Christoph Lameter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Christoph Lameter @ 2006-06-27 17:45 UTC (permalink / raw)
  To: akpm; +Cc: Nick Piggin, Pekka Enberg, Christoph Lameter, linux-kernel

ZVC: Fix potential use of out of range page in kmem_getpages.

We use page_zone(page) following several page increments in kmem_getpages().
Which page in a zone we use really does not matter. However, we may reach an
invalid page and then oops.

So move the counter decrement before we increment page.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm3/mm/slab.c
===================================================================
--- linux-2.6.17-mm3.orig/mm/slab.c	2006-06-27 09:40:25.620599382 -0700
+++ linux-2.6.17-mm3/mm/slab.c	2006-06-27 09:40:32.330144958 -0700
@@ -1539,12 +1539,12 @@ static void kmem_freepages(struct kmem_c
 	struct page *page = virt_to_page(addr);
 	const unsigned long nr_freed = i;
 
+	sub_zone_page_state(page_zone(page), NR_SLAB, nr_freed);
 	while (i--) {
 		BUG_ON(!PageSlab(page));
 		__ClearPageSlab(page);
 		page++;
 	}
-	sub_zone_page_state(page_zone(page), NR_SLAB, nr_freed);
 	if (current->reclaim_state)
 		current->reclaim_state->reclaimed_slab += nr_freed;
 	free_pages((unsigned long)addr, cachep->gfporder);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-27 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-27 17:45 [ZVC 1/4] Fix potential use of out of range page in kmem_getpages Christoph Lameter
2006-06-27 17:45 ` [ZVC 2/4] highmem.c: Use page after it may have been freed Christoph Lameter
2006-06-27 17:46 ` [ZVC 3/4] Include vmstat.h in mm.h and not in page-flags.h Christoph Lameter
2006-06-27 17:46 ` [ZVC 4/4] Inline counters for single processor configurations Christoph Lameter
2006-06-27 18:05   ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®