Title: [6194] trunk/fs/ramfs/file-nommu.c: apply mainline commit 15e7b8767605dc0cb9bd4594caabfec392385210
Revision
6194
Author
vapier
Date
2009-03-17 08:59:35 -0500 (Tue, 17 Mar 2009)

Log Message

apply mainline commit 15e7b8767605dc0cb9bd4594caabfec392385210
Author: Johannes Weiner <[email protected]>
Date:   Fri Mar 13 13:51:58 2009 -0700

nommu: ramfs: don't leak pages when adding to page cache fails

When a ramfs nommu mapping is expanded, contiguous pages are allocated
and added to the pagecache.  The caller's reference is then passed on
by moving whole pagevecs to the file lru list.

If the page cache adding fails, make sure that the error path also
moves the pagevec contents which might still contain up to PAGEVEC_SIZE
successfully added pages, of which we would leak references otherwise.

Signed-off-by: Johannes Weiner <[email protected]>
Cc: David Howells <[email protected]>
Cc: Enrik Berkhan <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>

Modified Paths

Diff

Modified: trunk/fs/ramfs/file-nommu.c (6193 => 6194)


--- trunk/fs/ramfs/file-nommu.c	2009-03-17 13:57:54 UTC (rev 6193)
+++ trunk/fs/ramfs/file-nommu.c	2009-03-17 13:59:35 UTC (rev 6194)
@@ -129,6 +129,7 @@
 	return -EFBIG;
 
  add_error:
+	pagevec_lru_add_file(&lru_pvec);
 	page_cache_release(pages + loop);
 	for (loop++; loop < npages; loop++)
 		__free_page(pages + loop);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to