xfs: Sanity check flags of Q_XQUOTARM call
authorJan Kara <jack@suse.cz>
Thu, 24 Oct 2019 00:00:45 +0000 (17:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:24:00 +0000 (10:24 +0100)
commit 3dd4d40b420846dd35869ccc8f8627feef2cff32 upstream.

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

Fixes: 9da93f9b7cdf ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_quotaops.c

index f82d79a8c694a8f32427b8d0e2923dbde1670d88..a7c3da09b72f9c0384080903332aaee243b5c2c1 100644 (file)
@@ -214,6 +214,9 @@ xfs_fs_rm_xquota(
        if (XFS_IS_QUOTA_ON(mp))
                return -EINVAL;
 
+       if (uflags & ~(FS_USER_QUOTA | FS_GROUP_QUOTA | FS_PROJ_QUOTA))
+               return -EINVAL;
+
        if (uflags & FS_USER_QUOTA)
                flags |= XFS_DQ_USER;
        if (uflags & FS_GROUP_QUOTA)