From: Brian Foster Date: Fri, 22 Feb 2013 18:32:56 +0000 (-0500) Subject: xfs: fix potential infinite loop in xfs_iomap_prealloc_size() X-Git-Tag: v3.9-rc4~23^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83cdadd8b0559c93728d065d23ca3485fa567e54;p=platform%2Fkernel%2Flinux-exynos.git xfs: fix potential infinite loop in xfs_iomap_prealloc_size() If freesp == 0, we could end up in an infinite loop while squashing the preallocation. Break the loop when we've killed the prealloc entirely. Signed-off-by: Brian Foster Reviewed-by: Dave Chinner Signed-off-by: Ben Myers (cherry picked from commit e78c420bfc2608bb5f9a0b9165b1071c1e31166a) --- diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 912d83d..b0b0f44 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -413,7 +413,7 @@ xfs_iomap_prealloc_size( * have a large file on a small filesystem and the above * lowspace thresholds are smaller than MAXEXTLEN. */ - while (alloc_blocks >= freesp) + while (alloc_blocks && alloc_blocks >= freesp) alloc_blocks >>= 4; }