From ee18e00330ee344bbce3c33f82c6a1d1f55db356 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 18 Apr 2014 11:50:49 -0400 Subject: [PATCH] add patch enforce-regular-file-in-ext4_zero_range --- enforce-regular-file-in-ext4_zero_range | 24 ++++++++++++++++++++++++ series | 1 + 2 files changed, 25 insertions(+) create mode 100644 enforce-regular-file-in-ext4_zero_range diff --git a/enforce-regular-file-in-ext4_zero_range b/enforce-regular-file-in-ext4_zero_range new file mode 100644 index 00000000..1d147033 --- /dev/null +++ b/enforce-regular-file-in-ext4_zero_range @@ -0,0 +1,24 @@ +ext4: enforce we are operating on a regular file in ext4_zero_range() + +From: jon ernst + +Signed-off-by: Jon Ernst +Signed-off-by: "Theodore Ts'o" +--- + fs/ext4/extents.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c +index d0860f2..2f49b12a 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. diff --git a/series b/series index 6e0ced52..d2db74c2 100644 --- a/series +++ b/series @@ -27,6 +27,7 @@ fix-removing-status-extents-in-ext4_collapse-range no-need-to-truncate-pagecache-twice-in-collapse-range discard-preallocations-after-removing-space fix-extent-merging-in-ext4_shift_path_extents +enforce-regular-file-in-ext4_zero_range # ^^^ above are to be pushed to Linus for 3.15-rc1 -- 2.11.4.GIT