| To: | david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx |
|---|---|
| Subject: | [PATCH 02/10] xfs_db: don't crash on a corrupt inode |
| From: | "Darrick J. Wong" <djwong@xxxxxxxxxxxxxxxx> |
| Date: | Fri, 14 Aug 2015 18:43:51 -0700 |
| Cc: | xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <20150815014338.1839.37405.stgit@xxxxxxxxxxxxxxxx> |
| References: | <20150815014338.1839.37405.stgit@xxxxxxxxxxxxxxxx> |
| User-agent: | StGit/0.17.1-dirty |
If the user selects a corrupt inode via the 'inode XXX' command, the
read verifier will fail and the io cursor at the top of the ring will
not have any data attached. When this is the case, we cannot
dereference the NULL pointer or xfs_db will crash. Therefore, check
the buffer pointer before using it.
It's arguable that we ought to retry the read without the verifiers
if the inode is corrupt or fails CRC, since this /is/ a debugging
tool, and maybe you wanted the contents anyway.
Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
db/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/db/inode.c b/db/inode.c
index e86dabd..64b263b 100644
--- a/db/inode.c
+++ b/db/inode.c
@@ -682,6 +682,8 @@ set_cur_inode(
set_cur(&typtab[TYP_INODE], XFS_AGB_TO_DADDR(mp, agno, cluster_agbno),
numblks, DB_RING_IGN, NULL);
off_cur(offset << mp->m_sb.sb_inodelog, mp->m_sb.sb_inodesize);
+ if (!iocur_top->data)
+ return;
dip = iocur_top->data;
iocur_top->ino_buf = 1;
iocur_top->ino = ino;
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 01/10] libxfs: readahead of dir3 data blocks should use the read verifier, Darrick J. Wong |
|---|---|
| Next by Date: | [PATCH 04/10] xfs_repair: fix broken EFSBADCRC/EFSCORRUPTED usage with buffer errors, Darrick J. Wong |
| Previous by Thread: | Re: [PATCH 01/10] libxfs: readahead of dir3 data blocks should use the read verifier, Darrick J. Wong |
| Next by Thread: | Re: [PATCH 02/10] xfs_db: don't crash on a corrupt inode, Eric Sandeen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |