]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/ext4/extents.c
ext4: enforce we are operating on a regular file in ext4_zero_range()
[mirror_ubuntu-bionic-kernel.git] / fs / ext4 / extents.c
index d0860f2d36d0aae5c7f8890fb44e67369264f634..2f49b12a4c40f66b6ec2700a5655d16bc30fc5cf 100644 (file)
@@ -4741,6 +4741,9 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 
        trace_ext4_zero_range(inode, offset, len, mode);
 
+       if (!S_ISREG(inode->i_mode))
+               return -EINVAL;
+
        /*
         * Write out all dirty pages to avoid race conditions
         * Then release them.