On Wednesday, January 29, 2020 10:32 PM Christoph Hellwig wrote: > While the flags field in the ABI and the on-disk format allows for > multiple namespace flags, that is a logically invalid combination and > listing multiple namespace flags will return no results as no attr > can have both set. Reject this case early with -EINVAL. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > fs/xfs/xfs_ioctl.c | 2 ++ > fs/xfs/xfs_ioctl32.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c > index d42de92cb283..d974bf099d45 100644 > --- a/fs/xfs/xfs_ioctl.c > +++ b/fs/xfs/xfs_ioctl.c > @@ -317,6 +317,8 @@ xfs_attrlist_by_handle( > */ > if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) > return -EINVAL; The above statement makes sure that al_hreq.flags has only ATTR_ROOT and/or ATTR_SECURE flags set ... > + if (al_hreq.flags == (ATTR_ROOT | ATTR_SECURE)) > + return -EINVAL; > ... Hence if the execution control arrives here, we can be sure that the presence of no other bits need to be checked. Therefore the code is logically correct. Reviewed-by: Chandan Rajendra <chandanrlinux@xxxxxxxxx> > dentry = xfs_handlereq_to_dentry(parfilp, &al_hreq.hreq); > if (IS_ERR(dentry)) > diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c > index 769581a79c58..9705172e5410 100644 > --- a/fs/xfs/xfs_ioctl32.c > +++ b/fs/xfs/xfs_ioctl32.c > @@ -375,6 +375,8 @@ xfs_compat_attrlist_by_handle( > */ > if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) > return -EINVAL; > + if (al_hreq.flags == (ATTR_ROOT | ATTR_SECURE)) > + return -EINVAL; > > dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq); > if (IS_ERR(dentry)) > -- chandan