Skip to contentSkip to conversation

Disallow 32bit project quota id.

PATCH In review Arkadiusz Miśkiewicz 3 participants 4 messages Aug 26, 2010 – Sep 1, 2010 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Disallow 32bit project quota id.

Currently on-disk structure is able to keep only 16bit project quota id, so disallow 32bit ones. This fixes a problem where part of kernel structures holding project quota id uses 32bit variable while part (on-disk) uses 16bit variable which causes project quota member files to be inaccessible for some operations (like mv/rm).

---

Please queue for upcoming 2.6.36 fixes.

 fs/xfs/linux-2.6/xfs_ioctl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/xfs/linux-2.6/xfs_ioctl.c +4 -0
index 237f5ff..0166226 100644
@@ -906,6 +906,10 @@ xfs_ioctl_setattr(
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return XFS_ERROR(EIO);
 
+	/* Disallow 32bit project ids that because on-disk structure is 16bit only */
+	if (fa->fsx_projid > (__uint16_t)-1)
+		return XFS_ERROR(EINVAL);
+
 	/*
 	 * If disk quotas is on, we make sure that the dquots do exist on disk,
 	 * before we start any other transactions. Trying to do this later
Signature · 6 lines
1.7.1.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 20 lines · Arkadiusz Miśkiewicz

Currently on-disk structure is able to keep only 16bit project quota id, so disallow 32bit ones. This fixes a problem where part of kernel structures holding project quota id uses 32bit variable while part (on-disk) uses 16bit variable which causes project quota member files to be inaccessible for some operations (like mv/rm).

---

Please queue for upcoming 2.6.36 fixes.

 fs/xfs/linux-2.6/xfs_ioctl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/xfs/linux-2.6/xfs_ioctl.c +0 -0
index 237f5ff..0166226 100644

fs/xfs/linux-2.6/xfs_ioctl.c xfs_ioctl_setattr( · line 912

Quoted 7 lines
fs/xfs/linux-2.6/xfs_ioctl.c +4 -0
@@ -906,6 +906,10 @@ xfs_ioctl_setattr(
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return XFS_ERROR(EIO);
 
+	/* Disallow 32bit project ids that because on-disk structure is 16bit only */
+	if (fa->fsx_projid > (__uint16_t)-1)
+		return XFS_ERROR(EINVAL);
+

If think that needs to include a (mask & FSX_PROJID) check first. i.e. only validate the projid if it was set by userspace.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

PATCH 1/1 Disallow 32bit project quota id.

Currently on-disk structure is able to keep only 16bit project quota id, so disallow 32bit ones. This fixes a problem where parts of kernel structures holding project quota id are 32bit while parts (on-disk) are 16bit variables which causes project quota member files to be inaccessible for some operations (like mv/rm).

---

Issues solved:
- FSX_PROJID in mask is checked
- 80 column issue fixed
- checkpath.pl checked

 fs/xfs/linux-2.6/xfs_ioctl.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
fs/xfs/linux-2.6/xfs_ioctl.c +7 -0
index 237f5ff..4fec427 100644
@@ -907,6 +907,13 @@ xfs_ioctl_setattr(
 		return XFS_ERROR(EIO);
 
 	/*
+	 * Disallow 32bit project ids because on-disk structure
+	 * is 16bit only.
+	 */
+	if ((mask & FSX_PROJID) && (fa->fsx_projid > (__uint16_t)-1))
+		return XFS_ERROR(EINVAL);
+
+	/*
 	 * If disk quotas is on, we make sure that the dquots do exist on disk,
 	 * before we start any other transactions. Trying to do this later
 	 * is messy. We don't care to take a readlock to look at the ids
Signature · 6 lines
1.7.2.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#3 lore raw
Quoted 7 lines · Arkadiusz Mi??kiewicz

Currently on-disk structure is able to keep only 16bit project quota id, so disallow 32bit ones. This fixes a problem where parts of kernel structures holding project quota id are 32bit while parts (on-disk) are 16bit variables which causes project quota member files to be inaccessible for some operations (like mv/rm).

Looks good,

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs