diff options
| author | Luis R. Rodriguez <mcgrof@kernel.org> | 2018-05-13 16:45:56 -0400 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2018-05-13 16:45:56 -0400 |
| commit | 6390d33bf5d9b24fd4f96e415b6888f59c8494f9 (patch) | |
| tree | 41abc900ed27d46cb27466a562babf2a443af09e /fs/ext4 | |
| parent | 71fe989961374ae55863c5da527bcf45be020834 (diff) | |
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 <mcgrof@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/inode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0eb64e8f9602..9d512fa80d28 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) | |||
| 4965 | inode->i_op = &ext4_dir_inode_operations; | 4965 | inode->i_op = &ext4_dir_inode_operations; |
| 4966 | inode->i_fop = &ext4_dir_operations; | 4966 | inode->i_fop = &ext4_dir_operations; |
| 4967 | } else if (S_ISLNK(inode->i_mode)) { | 4967 | } else if (S_ISLNK(inode->i_mode)) { |
| 4968 | /* VFS does not allow setting these so must be corruption */ | ||
| 4969 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) { | ||
| 4970 | EXT4_ERROR_INODE(inode, | ||
| 4971 | "immutable or append flags not allowed on symlinks"); | ||
| 4972 | ret = -EFSCORRUPTED; | ||
| 4973 | goto bad_inode; | ||
| 4974 | } | ||
| 4968 | if (ext4_encrypted_inode(inode)) { | 4975 | if (ext4_encrypted_inode(inode)) { |
| 4969 | inode->i_op = &ext4_encrypted_symlink_inode_operations; | 4976 | inode->i_op = &ext4_encrypted_symlink_inode_operations; |
| 4970 | ext4_set_aops(inode); | 4977 | ext4_set_aops(inode); |
