xfs
[Top] [All Lists]

[patch 08/12] Fix compat XFS_IOC_FSBULKSTAT_SINGLE ioctl

To: xfs@xxxxxxxxxxx
Subject: [patch 08/12] Fix compat XFS_IOC_FSBULKSTAT_SINGLE ioctl
From: sandeen@xxxxxxxxxxx
Date: Tue, 25 Nov 2008 21:20:13 -0600
References: <20081126032005.639750968@xxxxxxxxxxx>
User-agent: quilt/0.46-1
The XFS_IOC_FSBULKSTAT_SINGLE ioctl passes in the
desired inode number, while XFS_IOC_FSBULKSTAT passes
in the previous/last-stat'd inode number.  The
compat handler wasn't differentiating these, so
when a XFS_IOC_FSBULKSTAT_SINGLE request for inode
128 was sent in, stat information for 131 was sent out.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
--

Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl32.c   2008-11-24 
17:00:30.486001225 -0600
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl32.c        2008-11-24 
17:09:26.662001447 -0600
@@ -292,15 +292,22 @@ xfs_compat_ioc_bulkstat(
        if (bulkreq.ubuffer == NULL)
                return -XFS_ERROR(EINVAL);
 
-       if (cmd == XFS_IOC_FSINUMBERS_32)
+       if (cmd == XFS_IOC_FSINUMBERS_32) {
                error = xfs_inumbers(mp, &inlast, &count,
                                bulkreq.ubuffer, xfs_inumbers_fmt_compat);
-       else {
+       } else if (cmd == XFS_IOC_FSBULKSTAT_SINGLE_32) {
+               int res;
+
+               error = xfs_bulkstat_one_compat(mp, inlast, bulkreq.ubuffer,
+                               sizeof(compat_xfs_bstat_t),
+                               NULL, 0, NULL, NULL, &res);
+       } else if (cmd == XFS_IOC_FSBULKSTAT_32) {
                error = xfs_bulkstat(mp, &inlast, &count,
                        xfs_bulkstat_one_compat, NULL,
                        sizeof(compat_xfs_bstat_t), bulkreq.ubuffer,
                        BULKSTAT_FG_QUICK, &done);
-       }
+       } else
+               error = XFS_ERROR(EINVAL);
        if (error)
                return -error;
 

-- 

<Prev in Thread] Current Thread [Next in Thread>