diff options
author | Vlad Apostolov <vapo@sgi.com> | 2006-09-27 21:06:15 -0400 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2006-09-27 21:06:15 -0400 |
commit | 6f1f21684078884b62cfff2ea80a1a6c07f79824 (patch) | |
tree | fb238ef535e721cf6a0e992a416455335db26ad2 /fs/xfs | |
parent | 6216ff18839bf302805f67c93e8bc344387c513b (diff) |
[XFS] pv 956241, author: nathans, rv: vapo - make ino validation checks
consistent in bulkstat
SGI-PV: 956241
SGI-Modid: xfs-linux-melb:xfs-kern:26984a
Signed-off-by: Vlad Apostolov <vapo@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_itable.c | 24 | ||||
-rw-r--r-- | fs/xfs/xfs_itable.h | 5 |
2 files changed, 19 insertions, 10 deletions
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 136c6b06f1c9..80e5b96f5027 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -39,6 +39,16 @@ | |||
39 | #include "xfs_error.h" | 39 | #include "xfs_error.h" |
40 | #include "xfs_btree.h" | 40 | #include "xfs_btree.h" |
41 | 41 | ||
42 | int | ||
43 | xfs_internal_inum( | ||
44 | xfs_mount_t *mp, | ||
45 | xfs_ino_t ino) | ||
46 | { | ||
47 | return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || | ||
48 | (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && | ||
49 | (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))); | ||
50 | } | ||
51 | |||
42 | STATIC int | 52 | STATIC int |
43 | xfs_bulkstat_one_iget( | 53 | xfs_bulkstat_one_iget( |
44 | xfs_mount_t *mp, /* mount point for filesystem */ | 54 | xfs_mount_t *mp, /* mount point for filesystem */ |
@@ -213,17 +223,12 @@ xfs_bulkstat_one( | |||
213 | xfs_dinode_t *dip; /* dinode inode pointer */ | 223 | xfs_dinode_t *dip; /* dinode inode pointer */ |
214 | 224 | ||
215 | dip = (xfs_dinode_t *)dibuff; | 225 | dip = (xfs_dinode_t *)dibuff; |
226 | *stat = BULKSTAT_RV_NOTHING; | ||
216 | 227 | ||
217 | if (!buffer || ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || | 228 | if (!buffer || xfs_internal_inum(mp, ino)) |
218 | (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && | ||
219 | (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))) { | ||
220 | *stat = BULKSTAT_RV_NOTHING; | ||
221 | return XFS_ERROR(EINVAL); | 229 | return XFS_ERROR(EINVAL); |
222 | } | 230 | if (ubsize < sizeof(*buf)) |
223 | if (ubsize < sizeof(*buf)) { | ||
224 | *stat = BULKSTAT_RV_NOTHING; | ||
225 | return XFS_ERROR(ENOMEM); | 231 | return XFS_ERROR(ENOMEM); |
226 | } | ||
227 | 232 | ||
228 | buf = kmem_alloc(sizeof(*buf), KM_SLEEP); | 233 | buf = kmem_alloc(sizeof(*buf), KM_SLEEP); |
229 | 234 | ||
@@ -239,8 +244,7 @@ xfs_bulkstat_one( | |||
239 | } | 244 | } |
240 | 245 | ||
241 | if (copy_to_user(buffer, buf, sizeof(*buf))) { | 246 | if (copy_to_user(buffer, buf, sizeof(*buf))) { |
242 | *stat = BULKSTAT_RV_NOTHING; | 247 | error = EFAULT; |
243 | error = EFAULT; | ||
244 | goto out_free; | 248 | goto out_free; |
245 | } | 249 | } |
246 | 250 | ||
diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h index 6926c373a0a9..f25a28862a17 100644 --- a/fs/xfs/xfs_itable.h +++ b/fs/xfs/xfs_itable.h | |||
@@ -81,6 +81,11 @@ xfs_bulkstat_one( | |||
81 | void *dibuff, | 81 | void *dibuff, |
82 | int *stat); | 82 | int *stat); |
83 | 83 | ||
84 | int | ||
85 | xfs_internal_inum( | ||
86 | xfs_mount_t *mp, | ||
87 | xfs_ino_t ino); | ||
88 | |||
84 | int /* error status */ | 89 | int /* error status */ |
85 | xfs_inumbers( | 90 | xfs_inumbers( |
86 | xfs_mount_t *mp, /* mount point for filesystem */ | 91 | xfs_mount_t *mp, /* mount point for filesystem */ |