Skip to contentSkip to conversation

xfs: Sanity check flags of Q_XQUOTARM call

PATCH In review Jan Kara 3 participants 3 messages Oct 23, 2019 – Oct 28, 2019 XFS filesystem

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 xfs: Sanity check flags of Q_XQUOTARM call

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

Fixes 9da93f9b7cdf ("xfs: fix Q_XQUOTARM ioctl")
---
 fs/xfs/xfs_quotaops.c | 3 +++
 1 file changed, 3 insertions(+)

Strictly speaking this may cause user visible regression (invalid flags are no longer getting ignored) but in this particular case I think we could get away with it.

fs/xfs/xfs_quotaops.c +3 -0
index cd6c7210a373..c7de17deeae6 100644
@@ -201,6 +201,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)
Signature · 1 line
2.16.4
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Kara
Quoted 6 lines · Jan Kara

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

Fixes 9da93f9b7cdf ("xfs: fix Q_XQUOTARM ioctl")

Looks ok,

--D

Quoted 26 lines
---
 fs/xfs/xfs_quotaops.c | 3 +++
 1 file changed, 3 insertions(+)

Strictly speaking this may cause user visible regression (invalid flags are no longer getting ignored) but in this particular case I think we could get away with it.

fs/xfs/xfs_quotaops.c +3 -0
index cd6c7210a373..c7de17deeae6 100644
@@ -201,6 +201,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)
Signature · 1 line
2.16.4