xfs: Sanity check flags of Q_XQUOTARM call

Flags passed to Q_XQUOTARM were not sanity checked for invalid values.
Fix that.

Fixes: 9da93f9b7c ("xfs: fix Q_XQUOTARM ioctl")
Reported-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
Jan Kara 2019-10-23 17:00:45 -07:00 committed by Darrick J. Wong
parent 1aa6300638
commit 3dd4d40b42

View File

@ -201,6 +201,9 @@ xfs_fs_rm_xquota(
if (XFS_IS_QUOTA_ON(mp)) if (XFS_IS_QUOTA_ON(mp))
return -EINVAL; return -EINVAL;
if (uflags & ~(FS_USER_QUOTA | FS_GROUP_QUOTA | FS_PROJ_QUOTA))
return -EINVAL;
if (uflags & FS_USER_QUOTA) if (uflags & FS_USER_QUOTA)
flags |= XFS_DQ_USER; flags |= XFS_DQ_USER;
if (uflags & FS_GROUP_QUOTA) if (uflags & FS_GROUP_QUOTA)