Re: [PATCH 05/12] xfs: fix missing check for invalid attr flags

Darrick J. Wong
2024-04-10T21:04:19Z

On Tue, Apr 09, 2024 at 10:07:10PM -0700, Christoph Hellwig wrote:
> On Tue, Apr 09, 2024 at 05:51:41PM -0700, Darrick J. Wong wrote:
> > +#define XFS_ATTR_ONDISK_MASK (XFS_ATTR_NSP_ONDISK_MASK | \
> > + XFS_ATTR_LOCAL | \
> > + XFS_ATTR_INCOMPLETE)
>
> Note that XFS_ATTR_LOCAL and XFS_ATTR_INCOMPLETE are not valid for
> short form directories. Should we check for that somewhere as well?

Good point, xchk_xattr_check_sf should be flagging those too:

/*
* Shortform entries do not set LOCAL or INCOMPLETE, so the only
* valid flag bits here are for namespaces.
*/
if (sfe->flags & ~XFS_ATTR_NSP_ONDISK_MASK) {
xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, 0);
break;
}

I'll tack that on the end.

> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks!

--D