The patch titled nommu: ramfs: don't leak pages when adding to page cache fails has been added to the -mm tree. Its filename is nommu-ramfs-dont-leak-pages-when-adding-to-page-cache-fails.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: nommu: ramfs: don't leak pages when adding to page cache fails From: Johannes Weiner <hannes@xxxxxxxxxxx> 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 <hannes@xxxxxxxxxxx> Cc: David Howells <dhowells@xxxxxxxxxx> Cc: Enrik Berkhan <Enrik.Berkhan@xxxxxx> Cc: Nick Piggin <nickpiggin@xxxxxxxxxxxx> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ramfs/file-nommu.c | 1 + 1 file changed, 1 insertion(+) diff -puN fs/ramfs/file-nommu.c~nommu-ramfs-dont-leak-pages-when-adding-to-page-cache-fails fs/ramfs/file-nommu.c --- a/fs/ramfs/file-nommu.c~nommu-ramfs-dont-leak-pages-when-adding-to-page-cache-fails +++ a/fs/ramfs/file-nommu.c @@ -128,6 +128,7 @@ int ramfs_nommu_expand_for_mapping(struc return -EFBIG; add_error: + pagevec_lru_add_file(&lru_pvec); page_cache_release(pages + loop); for (loop++; loop < npages; loop++) __free_page(pages + loop); _ Patches currently in -mm which might be from hannes@xxxxxxxxxxx are linux-next.patch cifs-use-kzfree.patch s390-use-kzfree.patch usb-use-kzfree.patch crypto-use-kzfree.patch nommu-ramfs-pages-allocated-to-an-inodes-pagecache-may-get-wrongly-discarded.patch nommu-ramfs-pages-allocated-to-an-inodes-pagecache-may-get-wrongly-discarded-fix.patch nommu-ramfs-dont-leak-pages-when-adding-to-page-cache-fails.patch vmscan-rename-scmay_swap-to-may_unmap.patch mm-introduce-for_each_populated_zone-macro.patch mm-introduce-for_each_populated_zone-macro-cleanup.patch mm-shrink_all_memory-use-scnr_reclaimed.patch mm-shrink_all_memory-use-scnr_reclaimed-checkpatch-fixes.patch vmscan-clip-swap_cluster_max-in-shrink_all_memory.patch vmscan-respect-higher-order-in-zone_reclaim.patch mm-move-pagevec-stripping-to-save-unlock-relock.patch mm-dont-free-swap-slots-on-page-deactivation.patch mm-remove-pagevec_swap_free.patch ecryptfs-use-kzfree.patch memcg-remove-mem_cgroup_calc_mapped_ratio-take2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html