]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: check owner of dir3 free blocks
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 May 2020 21:37:09 +0000 (17:37 -0400)
committerEric Sandeen <sandeen@redhat.com>
Fri, 1 May 2020 21:37:09 +0000 (17:37 -0400)
Source kernel commit: 6fb5aac73310d030be13eb3481fdb7c7cc7c0f00

Check the owner field of dir3 free block headers and reject the metadata
if there's something wrong with it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_dir2_node.c

index 48c06da24e5236b63f19172521af945654f2db65..b2026da5573122ca08fc07d0af24ec5352e5784e 100644 (file)
@@ -191,6 +191,8 @@ xfs_dir3_free_header_check(
                        return __this_address;
                if (be32_to_cpu(hdr3->nvalid) < be32_to_cpu(hdr3->nused))
                        return __this_address;
+               if (be64_to_cpu(hdr3->hdr.owner) != dp->i_ino)
+                       return __this_address;
        } else {
                struct xfs_dir2_free_hdr *hdr = bp->b_addr;