summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorZev Weiss <zev@bewilderbeest.net>2018-04-14 02:16:58 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-04-15 23:36:26 -0400
commit22762711479959754e005f5bb8e6abc37bf9e0ba (patch)
tree5d68bdb49a6908d061fe46a1c3c084708a35d286 /fs/read_write.c
parent60cc43fc888428bb2f18f08997432d426a243338 (diff)
fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range()
It's a fairly inconsequential bug, since fdput() won't actually try to fput() the file due to fd.flags (and thus FDPUT_FPUT) being zero in the failure case, but most other vfs code takes steps to avoid this. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index c4eabbfc90df..e83bd9744b5d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -2023,7 +2023,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
2023 ret = mnt_want_write_file(dst_file); 2023 ret = mnt_want_write_file(dst_file);
2024 if (ret) { 2024 if (ret) {
2025 info->status = ret; 2025 info->status = ret;
2026 goto next_loop; 2026 goto next_fdput;
2027 } 2027 }
2028 2028
2029 dst_off = info->dest_offset; 2029 dst_off = info->dest_offset;
@@ -2058,9 +2058,9 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
2058 2058
2059next_file: 2059next_file:
2060 mnt_drop_write_file(dst_file); 2060 mnt_drop_write_file(dst_file);
2061next_loop: 2061next_fdput:
2062 fdput(dst_fd); 2062 fdput(dst_fd);
2063 2063next_loop:
2064 if (fatal_signal_pending(current)) 2064 if (fatal_signal_pending(current))
2065 goto out; 2065 goto out;
2066 } 2066 }