From: Mike O'Connor <mjo@dojo.mi.org>
Subject: XFS ftruncate() bug could expose stale data
References: 151055

With certain types of ftruncate() activity on 2.6 kernels, XFS
can end up exposing stale data off disk to a user, putting
extents where holes should be.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Index: linux-2.6.5-SLES9_SP3_BRANCH/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- linux-2.6.5-SLES9_SP3_BRANCH.orig/fs/xfs/linux-2.6/xfs_aops.c
+++ linux-2.6.5-SLES9_SP3_BRANCH/fs/xfs/linux-2.6/xfs_aops.c
@@ -349,7 +349,7 @@ xfs_probe_unmapped_cluster(
 
 	/* First sum forwards in this page */
 	do {
-		if (buffer_mapped(bh))
+		if (buffer_mapped(bh) || !buffer_uptodate(bh))
 			break;
 		total += bh->b_size;
 	} while ((bh = bh->b_this_page) != head);
