From: Luis R. Rodriguez Date: Sun, 13 May 2018 20:45:56 +0000 (-0400) Subject: ext4: add verifier check for symlink with append/immutable flags X-Git-Tag: v4.18-rc1~143^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6390d33bf5d9b24fd4f96e415b6888f59c8494f9;p=thirdparty%2Flinux.git ext4: add verifier check for symlink 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 Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara --- diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0eb64e8f96025..9d512fa80d28c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4965,6 +4965,13 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) inode->i_op = &ext4_dir_inode_operations; inode->i_fop = &ext4_dir_operations; } else if (S_ISLNK(inode->i_mode)) { + /* VFS does not allow setting these so must be corruption */ + if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) { + EXT4_ERROR_INODE(inode, + "immutable or append flags not allowed on symlinks"); + ret = -EFSCORRUPTED; + goto bad_inode; + } if (ext4_encrypted_inode(inode)) { inode->i_op = &ext4_encrypted_symlink_inode_operations; ext4_set_aops(inode);