[Top] [All Lists]

Re: [PATCH] xfs: Check error during inode btree iteration in xfs_bulksta

To: Jan Kara <jack@xxxxxxx>
Subject: Re: [PATCH] xfs: Check error during inode btree iteration in xfs_bulkstat()
From: jie liu <jeff.u.liu@xxxxxxxxx>
Date: Wed, 22 Oct 2014 18:29:48 +0800
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gGIOJ0xHBACUGETPWfGuekJgTRn9nDyZa5VIMa/ebo4=; b=Nd+uLN9UIer418hRYUp8sEiMNgnKKVEazWgb8wJ3zmqw1FjWXBQKbynfZ7s/nj0mBO AbeerP3mzp/pbF6UbJTkZAgYula4bsGiztKiF9b9e/qQEt5Af1gH5s+MUtnKq9ayE/B+ 4kJrAgjKjyQTQqNMAUZq9OU1SD+Q1InvZhd7ygWrzVSUt5tjzZG3vqsYb2cNoaS/kd0t TRibao0mPMJNcTZWmO4qzOssKkaCAGRVeQh8tdY5Et2qx5coNUkxTbXloVPk3FsGn2u0 t+JHHb+c+gd0VwS6tncDDaALQ4fz0Uet07FVPa51sxkDhYmMphU/XRUKdtPIXKbHoyRW xgRA==
In-reply-to: <1413901892-17117-1-git-send-email-jack@xxxxxxx>
References: <1413901892-17117-1-git-send-email-jack@xxxxxxx>
Looks good to me. Reviewed-by: Jie Liu <jeff.u.liu@xxxxxxxxx>


On Tue, Oct 21, 2014 at 10:31 PM, Jan Kara <jack@xxxxxxx> wrote:
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
Signed-off-by: Jan Kara <jack@xxxxxxx>
Âfs/xfs/xfs_itable.c | 4 ++++
Â1 file changed, 4 insertions(+)

diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index f1deb961a296..66d5c619517d 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;
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âbreak;
+Â Â Â Â Â Â Â Â Â Â Â Â}

xfs mailing list

<Prev in Thread] Current Thread [Next in Thread>