[ZVC,2/4] highmem.c: Use page after it may have been freed
diff mbox series

Message ID 20060627174556.11172.47432.sendpatchset@schroedinger.engr.sgi.com
State New, archived
Headers show
Series
  • [ZVC,1/4] Fix potential use of out of range page in kmem_getpages.
Related show

Commit Message

Christoph Lameter June 27, 2006, 5:45 p.m. UTC
ZVC: highmem.c: Use page after it may have been freed

This is not really a problem since the zone of a page does not
change after it has been freed but its cleaner to use the
page as a reference before it has been freed.

Move the dec_zone_page_state before the free.

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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch
diff mbox series

Index: linux-2.6.17-mm3/mm/highmem.c
===================================================================
--- linux-2.6.17-mm3.orig/mm/highmem.c	2006-06-27 09:40:25.586421810 -0700
+++ linux-2.6.17-mm3/mm/highmem.c	2006-06-27 09:42:19.342074956 -0700
@@ -315,8 +315,8 @@  static void bounce_end_io(struct bio *bi
 		if (bvec->bv_page == org_vec->bv_page)
 			continue;
 
-		mempool_free(bvec->bv_page, pool);	
 		dec_zone_page_state(bvec->bv_page, NR_BOUNCE);
+		mempool_free(bvec->bv_page, pool);
 	}
 
 	bio_endio(bio_orig, bio_orig->bi_size, err);