summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-10-30 10:34:52 +1100
committerDave Chinner <david@fromorbit.com>2014-10-30 10:34:52 +1100
commit7a19dee116c8fae7ba7a778043c245194289f5a2 (patch)
tree7cf54ac242a26dc2ff3a2a2fc6cbf81c2343a70c /fs/xfs
parenta6bbce54efa9145dbcf3029c885549f7ebc40a3b (diff)
downloadlinux-7a19dee116c8fae7ba7a778043c245194289f5a2.tar.gz
linux-7a19dee116c8fae7ba7a778043c245194289f5a2.tar.bz2
linux-7a19dee116c8fae7ba7a778043c245194289f5a2.zip
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: <stable@vger.kernel.org> Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Jie Liu <jeff.u.liu@gmail.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_itable.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index ef8ea0589780..7765ff743e91 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();
}