[Devel] [PATCH RH9 3/4] xfs: Don't show the active balloon to user
Kirill Tkhai
ktkhai at virtuozzo.com
Fri Oct 22 19:40:39 MSK 2021
Prohibit a notpriviliged user to reach balloon.
Prohibit everything to unlink it.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
fs/xfs/xfs_inode.c | 4 ++++
fs/xfs/xfs_iops.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 990b72ae3635..32f99876dc19 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -670,6 +670,10 @@ xfs_lookup(
if (error)
goto out_unlock;
+ error = -EPERM;
+ if (unlikely(inum == READ_ONCE(dp->i_mount->m_balloon_ino)))
+ goto out_free_name;
+
error = xfs_iget(dp->i_mount, NULL, inum, 0, 0, ipp);
if (error)
goto out_free_name;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 93c082db04b7..09211e1d08ad 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -382,6 +382,10 @@ xfs_vn_unlink(
struct xfs_name name;
int error;
+ if (unlikely(d_inode(dentry)->i_ino ==
+ READ_ONCE(XFS_I(dir)->i_mount->m_balloon_ino)))
+ return -EPERM;
+
xfs_dentry_to_name(&name, dentry);
error = xfs_remove(XFS_I(dir), &name, XFS_I(d_inode(dentry)));
More information about the Devel
mailing list