Skip to contentSkip to conversation

xfs_db: don't crash in ablock if there's no inode

PATCH New Darrick J. Wong 1 participant 1 message Feb 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_db: don't crash in ablock if there's no inode

From: Darrick J. Wong <[email protected]>

Make sure we actually have an inode selected before trying to unwrap its attribute fork. Found via a crash in xfs/288 with project quotas enabled.

---
 db/block.c |    5 +++++
 1 file changed, 5 insertions(+)
db/block.c +5 -0
index 5ecd687..174e29a 100644
@@ -84,6 +84,11 @@ ablock_f(
 	}
 	push_cur();
 	set_cur_inode(iocur_top->ino);
+	if (!iocur_top->data) {
+		pop_cur();
+		dbprintf(_("no current inode\n"));
+		return 0;
+	}
 	haveattr = XFS_DFORK_Q((xfs_dinode_t *)iocur_top->data);
 	pop_cur();
 	if (!haveattr) {