From: Darrick J. Wong Date: Fri, 1 May 2020 21:37:09 +0000 (-0400) Subject: xfs: check owner of dir3 free blocks X-Git-Tag: v5.7.0-rc0~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb77154320fb6108ac1721fcd9cef15c77371427;p=thirdparty%2Fxfsprogs-dev.git xfs: check owner of dir3 free blocks 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 Reviewed-by: Allison Collins Reviewed-by: Christoph Hellwig Reviewed-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index 48c06da24..b2026da55 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -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;