[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>
This commit is contained in:
@@ -563,8 +563,7 @@ xfs_qm_dqtobp(
|
|||||||
*/
|
*/
|
||||||
if (dqp->q_blkno == (xfs_daddr_t) 0) {
|
if (dqp->q_blkno == (xfs_daddr_t) 0) {
|
||||||
/* We use the id as an index */
|
/* We use the id as an index */
|
||||||
dqp->q_fileoffset = (xfs_fileoff_t) ((uint)id /
|
dqp->q_fileoffset = (xfs_fileoff_t)id / XFS_QM_DQPERBLK(mp);
|
||||||
XFS_QM_DQPERBLK(mp));
|
|
||||||
nmaps = 1;
|
nmaps = 1;
|
||||||
quotip = XFS_DQ_TO_QIP(dqp);
|
quotip = XFS_DQ_TO_QIP(dqp);
|
||||||
xfs_ilock(quotip, XFS_ILOCK_SHARED);
|
xfs_ilock(quotip, XFS_ILOCK_SHARED);
|
||||||
|
@@ -109,10 +109,7 @@ xfs_qm_quotactl(
|
|||||||
vfsp = bhvtovfs(bdp);
|
vfsp = bhvtovfs(bdp);
|
||||||
mp = XFS_VFSTOM(vfsp);
|
mp = XFS_VFSTOM(vfsp);
|
||||||
|
|
||||||
if (addr == NULL && cmd != Q_SYNC)
|
ASSERT(addr != NULL);
|
||||||
return XFS_ERROR(EINVAL);
|
|
||||||
if (id < 0 && cmd != Q_SYNC)
|
|
||||||
return XFS_ERROR(EINVAL);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following commands are valid even when quotaoff.
|
* The following commands are valid even when quotaoff.
|
||||||
@@ -122,7 +119,7 @@ xfs_qm_quotactl(
|
|||||||
/*
|
/*
|
||||||
* Truncate quota files. quota must be off.
|
* Truncate quota files. quota must be off.
|
||||||
*/
|
*/
|
||||||
if (XFS_IS_QUOTA_ON(mp) || addr == NULL)
|
if (XFS_IS_QUOTA_ON(mp))
|
||||||
return XFS_ERROR(EINVAL);
|
return XFS_ERROR(EINVAL);
|
||||||
if (vfsp->vfs_flag & VFS_RDONLY)
|
if (vfsp->vfs_flag & VFS_RDONLY)
|
||||||
return XFS_ERROR(EROFS);
|
return XFS_ERROR(EROFS);
|
||||||
@@ -140,8 +137,6 @@ xfs_qm_quotactl(
|
|||||||
* QUOTAON - enabling quota enforcement.
|
* QUOTAON - enabling quota enforcement.
|
||||||
* Quota accounting must be turned on at mount time.
|
* Quota accounting must be turned on at mount time.
|
||||||
*/
|
*/
|
||||||
if (addr == NULL)
|
|
||||||
return XFS_ERROR(EINVAL);
|
|
||||||
if (vfsp->vfs_flag & VFS_RDONLY)
|
if (vfsp->vfs_flag & VFS_RDONLY)
|
||||||
return XFS_ERROR(EROFS);
|
return XFS_ERROR(EROFS);
|
||||||
return (xfs_qm_scall_quotaon(mp,
|
return (xfs_qm_scall_quotaon(mp,
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
* uid_t and gid_t are hard-coded to 32 bits in the inode.
|
* uid_t and gid_t are hard-coded to 32 bits in the inode.
|
||||||
* Hence, an 'id' in a dquot is 32 bits..
|
* Hence, an 'id' in a dquot is 32 bits..
|
||||||
*/
|
*/
|
||||||
typedef __int32_t xfs_dqid_t;
|
typedef __uint32_t xfs_dqid_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Eventhough users may not have quota limits occupying all 64-bits,
|
* Eventhough users may not have quota limits occupying all 64-bits,
|
||||||
|
Reference in New Issue
Block a user