[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180510231359.16899-5-mcgrof@kernel.org>
Date: Thu, 10 May 2018 16:13:59 -0700
From: "Luis R. Rodriguez" <mcgrof@...nel.org>
To: viro@...iv.linux.org.uk, darrick.wong@...cle.com, tytso@....edu,
adilger.kernel@...ger.ca, clm@...com, jbacik@...com,
dsterba@...e.com
Cc: sandeen@...deen.net, dhowells@...hat.com, fliu@...e.com,
jack@...e.cz, jeffm@...e.com, nborisov@...e.com,
jake.norris@...e.com, mtk.manpages@...il.com,
linux-api@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-xfs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
"Luis R. Rodriguez" <mcgrof@...nel.org>
Subject: [RFC v2 4/4] btrfs: verify symlinks with append/immutable flags
The Linux VFS does not allow a way to set append/immuttable
attributes to symlinks, this is just not possible. If this is
detected inform the user as the filesystem must be corrupted.
Signed-off-by: Luis R. Rodriguez <mcgrof@...nel.org>
---
fs/btrfs/inode.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c4bdb597b323..d9c786be408c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3933,6 +3933,15 @@ static int btrfs_read_locked_inode(struct inode *inode)
inode->i_op = &btrfs_dir_inode_operations;
break;
case S_IFLNK:
+ /* VFS does not allow setting these so must be corruption */
+ if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) {
+ ret = -EUCLEAN;
+ btrfs_crit(fs_info,
+ "corrupt symlink with append/immutable ino=%llu root=%llu\n",
+ btrfs_ino(BTRFS_I(inode)),
+ root->root_key.objectid);
+ goto make_bad;
+ }
inode->i_op = &btrfs_symlink_inode_operations;
inode_nohighmem(inode);
inode->i_mapping->a_ops = &btrfs_symlink_aops;
--
2.17.0
Powered by blists - more mailing lists