aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-11-01 18:31:41 -0500
committerNathan Scott <nathans@sgi.com>2005-11-01 18:31:41 -0500
commitc310ab6c071a688e5291028972d1ae8314f67536 (patch)
tree7ee30ba83f67139e5353ae45b8e18d9097198009 /fs/xfs
parent30dab21abbca37636091a6d02e94dbcd6e07b530 (diff)
[XFS] Fix signedness issues in dquot ID handling, allowing uids/gids above
MAXINT SGI-PV: 942528 SGI-Modid: xfs-linux:xfs-kern:23828a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/quota/xfs_dquot.c3
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c9
-rw-r--r--fs/xfs/xfs_quota.h2
3 files changed, 4 insertions, 10 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index e2e8d35fa4d0..9987977a4927 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -563,8 +563,7 @@ xfs_qm_dqtobp(
563 */ 563 */
564 if (dqp->q_blkno == (xfs_daddr_t) 0) { 564 if (dqp->q_blkno == (xfs_daddr_t) 0) {
565 /* We use the id as an index */ 565 /* We use the id as an index */
566 dqp->q_fileoffset = (xfs_fileoff_t) ((uint)id / 566 dqp->q_fileoffset = (xfs_fileoff_t)id / XFS_QM_DQPERBLK(mp);
567 XFS_QM_DQPERBLK(mp));
568 nmaps = 1; 567 nmaps = 1;
569 quotip = XFS_DQ_TO_QIP(dqp); 568 quotip = XFS_DQ_TO_QIP(dqp);
570 xfs_ilock(quotip, XFS_ILOCK_SHARED); 569 xfs_ilock(quotip, XFS_ILOCK_SHARED);
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 15e02e8a9d4f..4e397940b3a6 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -109,10 +109,7 @@ xfs_qm_quotactl(
109 vfsp = bhvtovfs(bdp); 109 vfsp = bhvtovfs(bdp);
110 mp = XFS_VFSTOM(vfsp); 110 mp = XFS_VFSTOM(vfsp);
111 111
112 if (addr == NULL && cmd != Q_SYNC) 112 ASSERT(addr != NULL);
113 return XFS_ERROR(EINVAL);
114 if (id < 0 && cmd != Q_SYNC)
115 return XFS_ERROR(EINVAL);
116 113
117 /* 114 /*
118 * The following commands are valid even when quotaoff. 115 * The following commands are valid even when quotaoff.
@@ -122,7 +119,7 @@ xfs_qm_quotactl(
122 /* 119 /*
123 * Truncate quota files. quota must be off. 120 * Truncate quota files. quota must be off.
124 */ 121 */
125 if (XFS_IS_QUOTA_ON(mp) || addr == NULL) 122 if (XFS_IS_QUOTA_ON(mp))
126 return XFS_ERROR(EINVAL); 123 return XFS_ERROR(EINVAL);
127 if (vfsp->vfs_flag & VFS_RDONLY) 124 if (vfsp->vfs_flag & VFS_RDONLY)
128 return XFS_ERROR(EROFS); 125 return XFS_ERROR(EROFS);
@@ -140,8 +137,6 @@ xfs_qm_quotactl(
140 * QUOTAON - enabling quota enforcement. 137 * QUOTAON - enabling quota enforcement.
141 * Quota accounting must be turned on at mount time. 138 * Quota accounting must be turned on at mount time.
142 */ 139 */
143 if (addr == NULL)
144 return XFS_ERROR(EINVAL);
145 if (vfsp->vfs_flag & VFS_RDONLY) 140 if (vfsp->vfs_flag & VFS_RDONLY)
146 return XFS_ERROR(EROFS); 141 return XFS_ERROR(EROFS);
147 return (xfs_qm_scall_quotaon(mp, 142 return (xfs_qm_scall_quotaon(mp,
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index 32cb79752d5d..ed965883f702 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -42,7 +42,7 @@
42 * uid_t and gid_t are hard-coded to 32 bits in the inode. 42 * uid_t and gid_t are hard-coded to 32 bits in the inode.
43 * Hence, an 'id' in a dquot is 32 bits.. 43 * Hence, an 'id' in a dquot is 32 bits..
44 */ 44 */
45typedef __int32_t xfs_dqid_t; 45typedef __uint32_t xfs_dqid_t;
46 46
47/* 47/*
48 * Eventhough users may not have quota limits occupying all 64-bits, 48 * Eventhough users may not have quota limits occupying all 64-bits,