]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: junk corrupt xattr root blocks
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 28 Sep 2020 21:35:37 +0000 (17:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 28 Sep 2020 21:35:37 +0000 (17:35 -0400)
If reading the root block of an extended attribute structure fails due
to a corruption error, we should junk the block since we know it's bad.
There's no point in moving on to the (rather insufficient) checks in the
attr code.

Found by fuzzing hdr.freemap[1].base = ones in xfs/400.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/attr_repair.c

index 6cec0f7075d5937479fb164b31b92a16fef84c2e..d92909e1c8312b1f96c60bea7d02966871026ef6 100644 (file)
@@ -1107,6 +1107,15 @@ process_longform_attr(
                        ino);
                return 1;
        }
+
+       if (bp->b_error == -EFSCORRUPTED) {
+               do_warn(
+       _("corrupt block 0 of inode %" PRIu64 " attribute fork\n"),
+                       ino);
+               libxfs_buf_relse(bp);
+               return 1;
+       }
+
        if (bp->b_error == -EFSBADCRC)
                (*repair)++;