Commit 7e937bb3 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: warn about inodes with project id of -1

Inodes aren't supposed to have a project id of -1U (aka 4294967295) but
the kernel hasn't always validated FSSETXATTR correctly.  Flag this as
something for the sysadmin to check out.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent eae44cb3
...@@ -233,6 +233,7 @@ xchk_dinode( ...@@ -233,6 +233,7 @@ xchk_dinode(
unsigned long long isize; unsigned long long isize;
uint64_t flags2; uint64_t flags2;
uint32_t nextents; uint32_t nextents;
prid_t prid;
uint16_t flags; uint16_t flags;
uint16_t mode; uint16_t mode;
...@@ -267,6 +268,7 @@ xchk_dinode( ...@@ -267,6 +268,7 @@ xchk_dinode(
* so just mark this inode for preening. * so just mark this inode for preening.
*/ */
xchk_ino_set_preen(sc, ino); xchk_ino_set_preen(sc, ino);
prid = 0;
break; break;
case 2: case 2:
case 3: case 3:
...@@ -279,12 +281,17 @@ xchk_dinode( ...@@ -279,12 +281,17 @@ xchk_dinode(
if (dip->di_projid_hi != 0 && if (dip->di_projid_hi != 0 &&
!xfs_has_projid32(mp)) !xfs_has_projid32(mp))
xchk_ino_set_corrupt(sc, ino); xchk_ino_set_corrupt(sc, ino);
prid = be16_to_cpu(dip->di_projid_lo);
break; break;
default: default:
xchk_ino_set_corrupt(sc, ino); xchk_ino_set_corrupt(sc, ino);
return; return;
} }
if (xfs_has_projid32(mp))
prid |= (prid_t)be16_to_cpu(dip->di_projid_hi) << 16;
/* /*
* di_uid/di_gid -- -1 isn't invalid, but there's no way that * di_uid/di_gid -- -1 isn't invalid, but there's no way that
* userspace could have created that. * userspace could have created that.
...@@ -293,6 +300,13 @@ xchk_dinode( ...@@ -293,6 +300,13 @@ xchk_dinode(
dip->di_gid == cpu_to_be32(-1U)) dip->di_gid == cpu_to_be32(-1U))
xchk_ino_set_warning(sc, ino); xchk_ino_set_warning(sc, ino);
/*
* project id of -1 isn't supposed to be valid, but the kernel didn't
* always validate that.
*/
if (prid == -1U)
xchk_ino_set_warning(sc, ino);
/* di_format */ /* di_format */
switch (dip->di_format) { switch (dip->di_format) {
case XFS_DINODE_FMT_DEV: case XFS_DINODE_FMT_DEV:
......
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