]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: don't return garbage buffers in xfs_da3_node_read
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 28 Jun 2018 20:11:57 +0000 (15:11 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 28 Jun 2018 20:11:57 +0000 (15:11 -0500)
Source kernel commit: 924cade4df49e7c9fddcbae678dbd9dee3b0aeb6

If we're reading a node in a dir/attr btree and the buffer comes off the
disk with a magic number we don't recognize, don't ASSERT and don't set
a garbage buffer type (0 also triggers ASSERTs).  Instead, report the
corruption, release the buffer, and return -EFSCORRUPTED because that's
what the dabtree is -- corrupt.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_da_btree.c

index 269edf9a2602d72f874d2b79466bfc4f69336cf4..5f71d817f6aef0fc07eea3d3e07236b4235f2e33 100644 (file)
@@ -300,9 +300,11 @@ xfs_da3_node_read(
                        type = XFS_BLFT_DIR_LEAFN_BUF;
                        break;
                default:
-                       type = 0;
-                       ASSERT(0);
-                       break;
+                       XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW,
+                                       tp->t_mountp, info);
+                       xfs_trans_brelse(tp, *bpp);
+                       *bpp = NULL;
+                       return -EFSCORRUPTED;
                }
                xfs_trans_buf_set_type(tp, *bpp, type);
        }