]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: don't crash in ablock if there's no inode
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 9 Mar 2018 02:35:23 +0000 (20:35 -0600)
committerEric Sandeen <sandeen@redhat.com>
Fri, 9 Mar 2018 02:35:23 +0000 (20:35 -0600)
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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/block.c

index 5ecd687ad9605a0f609f931ddb4d9ce41caee4b9..174e29ad422dec58c0de839f8f490d9f7ad35d6d 100644 (file)
@@ -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) {