Commit 29c1c123 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: scrub inode nsec fields

Check that the nanosecond fields in each timestamp aren't larger
than a billion.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 8e630837
...@@ -392,6 +392,14 @@ xfs_scrub_dinode( ...@@ -392,6 +392,14 @@ xfs_scrub_dinode(
break; break;
} }
/* di_[amc]time.nsec */
if (be32_to_cpu(dip->di_atime.t_nsec) >= NSEC_PER_SEC)
xfs_scrub_ino_set_corrupt(sc, ino, bp);
if (be32_to_cpu(dip->di_mtime.t_nsec) >= NSEC_PER_SEC)
xfs_scrub_ino_set_corrupt(sc, ino, bp);
if (be32_to_cpu(dip->di_ctime.t_nsec) >= NSEC_PER_SEC)
xfs_scrub_ino_set_corrupt(sc, ino, bp);
/* /*
* di_size. xfs_dinode_verify checks for things that screw up * di_size. xfs_dinode_verify checks for things that screw up
* the VFS such as the upper bit being set and zero-length * the VFS such as the upper bit being set and zero-length
...@@ -495,6 +503,8 @@ xfs_scrub_dinode( ...@@ -495,6 +503,8 @@ xfs_scrub_dinode(
} }
if (dip->di_version >= 3) { if (dip->di_version >= 3) {
if (be32_to_cpu(dip->di_crtime.t_nsec) >= NSEC_PER_SEC)
xfs_scrub_ino_set_corrupt(sc, ino, bp);
xfs_scrub_inode_flags2(sc, bp, dip, ino, mode, flags, flags2); xfs_scrub_inode_flags2(sc, bp, dip, ino, mode, flags, flags2);
xfs_scrub_inode_cowextsize(sc, bp, dip, ino, mode, flags, xfs_scrub_inode_cowextsize(sc, bp, dip, ino, mode, flags,
flags2); flags2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment