From: Dave Chinner Date: Mon, 14 Dec 2009 23:11:57 +0000 (+0000) Subject: XFS: Free buffer pages array unconditionally X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3fc98b1ac036675b95f6e3fafd5ef147b97d4d30;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git XFS: Free buffer pages array unconditionally The code in xfs_free_buf() only attempts to free the b_pages array if the buffer is a page cache backed or page allocated buffer. The extra log buffer that is used when the log wraps uses pages that are allocated to a different log buffer, but it still has a b_pages array allocated when those pages are associated to with the extra buffer in xfs_buf_associate_memory. Hence we need to always attempt to free the b_pages array when tearing down a buffer, not just on buffers that are explicitly marked as page bearing buffers. This fixes a leak detected by the kernel memory leak code. Signed-off-by: Dave Chinner Signed-off-by: Alex Elder --- diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 162359b664ca..77b8be81c769 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c @@ -292,6 +292,7 @@ _xfs_buf_free_pages( { if (bp->b_pages != bp->b_page_array) { kmem_free(bp->b_pages); + bp->b_pages = NULL; } } @@ -323,9 +324,8 @@ xfs_buf_free( ASSERT(!PagePrivate(page)); page_cache_release(page); } - _xfs_buf_free_pages(bp); } - + _xfs_buf_free_pages(bp); xfs_buf_deallocate(bp); }