From: Jan Kara Date: Wed, 29 Oct 2014 23:34:52 +0000 (+1100) Subject: xfs: Check error during inode btree iteration in xfs_bulkstat() X-Git-Tag: v5.15~16711^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a19dee116c8fae7ba7a778043c245194289f5a2;p=platform%2Fkernel%2Flinux-starfive.git xfs: Check error during inode btree iteration in xfs_bulkstat() xfs_bulkstat() doesn't check error return from xfs_btree_increment(). In case of specific fs corruption that could result in xfs_bulkstat() entering an infinite loop because we would be looping over the same chunk over and over again. Fix the problem by checking the return value and terminating the loop properly. Coverity-id: 1231338 cc: Signed-off-by: Jan Kara Reviewed-by: Jie Liu Signed-off-by: Dave Chinner --- diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index ef8ea05..7765ff7 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c @@ -474,6 +474,10 @@ xfs_bulkstat( */ agino = r.ir_startino + XFS_INODES_PER_CHUNK; error = xfs_btree_increment(cur, 0, &tmp); + if (error) { + end_of_ag = 1; + goto del_cursor; + } cond_resched(); }