]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit - repair/dinode.c
xfs_repair: fix bad next_unlinked field
authorEric Sandeen <sandeen@redhat.com>
Thu, 27 Feb 2020 19:21:45 +0000 (14:21 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 27 Feb 2020 19:21:45 +0000 (14:21 -0500)
commit6bd73d163462f5c0ca78197ec2d8d6f7392974d1
treed63d9e8011c94374be66103074304e5faf146266
parentad9435853441297969e974af00bde3ddff4a451d
xfs_repair: fix bad next_unlinked field

As of xfsprogs-4.17 we started testing whether the di_next_unlinked field
on an inode is valid in the inode verifiers. However, this field is never
tested or repaired during inode processing.

So if, for example, we had a completely zeroed-out inode, we'd detect and
fix the broken magic and version, but the invalid di_next_unlinked field
would not be touched, fail the write verifier, and prevent the inode from
being properly repaired or even written out.

Fix this by checking the di_next_unlinked inode field for validity and
clearing it if it is invalid.

Reported-by: John Jore <john@jore.no>
Fixes: 2949b4677 ("xfs: don't accept inode buffers with suspicious unlinked chains")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
repair/dinode.c