summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorjon ernst <jonernst07@gmail.com>2014-04-18 11:50:35 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-04-18 11:50:35 -0400
commit6c5e73d3a26b73bfcac0b4a932cb918177d067f2 (patch)
treed6d2b924970c973bf1dc948f54f556cfd1156829 /fs/ext4
parent6dd834effc12ba71092d9d1e4944530234b58ab1 (diff)
ext4: enforce we are operating on a regular file in ext4_zero_range()
Signed-off-by: Jon Ernst <jonernst07@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/extents.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index d0860f2d36d..2f49b12a4c4 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -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.