]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/ext4/inode.c
ext4: add verifier check for symlink with append/immutable flags
[mirror_ubuntu-bionic-kernel.git] / fs / ext4 / inode.c
index 284d05d70c5d9b39e9ecdf82e19962b6e8592666..8c63a2ad1ac2daa22a1daa06314e1a2a23168b4e 100644 (file)
@@ -4943,6 +4943,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);