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 <david@fromorbit.com>
Signed-off-by: Alex Elder <aelder@sgi.com>

authored by Dave Chinner and committed by Alex Elder 3fc98b1a a5f9be58

+2 -2
+2 -2
fs/xfs/linux-2.6/xfs_buf.c
··· 292 292 { 293 293 if (bp->b_pages != bp->b_page_array) { 294 294 kmem_free(bp->b_pages); 295 + bp->b_pages = NULL; 295 296 } 296 297 } 297 298 ··· 324 323 ASSERT(!PagePrivate(page)); 325 324 page_cache_release(page); 326 325 } 327 - _xfs_buf_free_pages(bp); 328 326 } 329 - 327 + _xfs_buf_free_pages(bp); 330 328 xfs_buf_deallocate(bp); 331 329 } 332 330