aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorVlad Apostolov <vapo@sgi.com>2006-09-27 21:06:15 -0400
committerTim Shimmin <tes@sgi.com>2006-09-27 21:06:15 -0400
commit6f1f21684078884b62cfff2ea80a1a6c07f79824 (patch)
treefb238ef535e721cf6a0e992a416455335db26ad2 /fs/xfs
parent6216ff18839bf302805f67c93e8bc344387c513b (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.c24
-rw-r--r--fs/xfs/xfs_itable.h5
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
42int
43xfs_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
42STATIC int 52STATIC int
43xfs_bulkstat_one_iget( 53xfs_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
84int
85xfs_internal_inum(
86 xfs_mount_t *mp,
87 xfs_ino_t ino);
88
84int /* error status */ 89int /* error status */
85xfs_inumbers( 90xfs_inumbers(
86 xfs_mount_t *mp, /* mount point for filesystem */ 91 xfs_mount_t *mp, /* mount point for filesystem */