]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xfs: also reject BULKSTAT_SINGLE in a mount user namespace
authorChristoph Hellwig <hch@lst.de>
Sun, 14 Mar 2021 17:59:39 +0000 (10:59 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 15 Mar 2021 15:50:41 +0000 (08:50 -0700)
BULKSTAT_SINGLE exposed the ondisk uids/gids just like bulkstat, and can
be called on any inode, including ones not visible in the current mount.

Fixes: b3e5acac691a ("xfs: support idmapped mounts")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_itable.c

index ca310a125d1e14d412b0d60790bfff8615e5b856..3498b97fb06d31710fb0f353d59d40c96232b769 100644 (file)
@@ -168,6 +168,12 @@ xfs_bulkstat_one(
        };
        int                     error;
 
+       if (breq->mnt_userns != &init_user_ns) {
+               xfs_warn_ratelimited(breq->mp,
+                       "bulkstat not supported inside of idmapped mounts.");
+               return -EINVAL;
+       }
+
        ASSERT(breq->icount == 1);
 
        bc.buf = kmem_zalloc(sizeof(struct xfs_bulkstat),