ext4: enforce we are operating on a regular file in ext4_zero_range()
authorjon ernst <jonernst07@gmail.com>
Fri, 18 Apr 2014 15:50:35 +0000 (11:50 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 18 Apr 2014 15:50:35 +0000 (11:50 -0400)
Signed-off-by: Jon Ernst <jonernst07@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
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.