lkml.org 
[lkml]   [2018]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v2 4/4] btrfs: verify symlinks with append/immutable flags
Date
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@kernel.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
\
 
 \ /
  Last update: 2018-05-11 01:15    [W:0.159 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site