xfs
[Top] [All Lists]

[PATCH 02/11] libxfs: verifier should set buffer error when da block has

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 02/11] libxfs: verifier should set buffer error when da block has a bad magic number
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Tue, 25 Aug 2015 17:32:33 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150826003220.23973.59731.stgit@xxxxxxxxxxxxxxxx>
References: <20150826003220.23973.59731.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
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.

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


diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c
index c874164..289dc1e 100644
--- a/libxfs/xfs_da_btree.c
+++ b/libxfs/xfs_da_btree.c
@@ -229,6 +229,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>