From: Darrick J. Wong <djwong@xxxxxxxxxx> Detect incorrectly set padding fields when large extent counts are enabled or disabled on v3 inodes. Found by fuzzing v3.flags2 = zeroes with xfs/374 and an nrext64=1 filesystem. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- repair/dinode.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/repair/dinode.c b/repair/dinode.c index 547c5833..1c92bfbd 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -2709,6 +2709,26 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"), } } + if (xfs_dinode_has_large_extent_counts(dino)) { + if (dino->di_nrext64_pad) { + if (!no_modify) { + do_warn(_("fixing bad nrext64_pad.\n")); + dino->di_nrext64_pad = 0; + *dirty = 1; + } else + do_warn(_("would fix bad nrext64_pad.\n")); + } + } else if (dino->di_version >= 3) { + if (dino->di_v3_pad) { + if (!no_modify) { + do_warn(_("fixing bad v3_pad.\n")); + dino->di_v3_pad = 0; + *dirty = 1; + } else + do_warn(_("would fix bad v3_pad.\n")); + } + } + if (!verify_mode && flags2 != be64_to_cpu(dino->di_flags2)) { if (!no_modify) { do_warn(_("fixing bad flags2.\n"));