xfs
[Top] [All Lists]

[PATCH v2] libxfs: verifier should set buffer error when da block has a

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: [PATCH v2] libxfs: verifier should set buffer error when da block has a bad magic number
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Mon, 24 Aug 2015 21:46:33 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
If xfs_da3_node_read_verify() doesn't recognize the magic number of a
buffer it's just read, set the buffer error to -EFSCORRUPTED so that
the error can be sent up to userspace.  Without this patch we'll
notice the bad magic eventually while trying to traverse or change
the block, but we really ought to fail early in the verifier.

v2: Mark the buffer corrupt in the default case to avoid blowing away
a CRC error code in the node block case.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_da_btree.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 2385f8c..8951e34 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -233,6 +233,7 @@ xfs_da3_node_read_verify(
                        bp->b_ops->verify_read(bp);
                        return;
                default:
+                       xfs_buf_ioerror(bp, -EFSCORRUPTED);
                        break;
        }
 

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH v2] libxfs: verifier should set buffer error when da block has a bad magic number, Darrick J. Wong <=