From: Zev Weiss Date: Sat, 14 Apr 2018 06:16:58 +0000 (-0500) Subject: fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range() X-Git-Tag: v4.19~946^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22762711479959754e005f5bb8e6abc37bf9e0ba;p=platform%2Fkernel%2Flinux-rpi3.git 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 Signed-off-by: Al Viro --- diff --git a/fs/read_write.c b/fs/read_write.c index c4eabbf..e83bd97 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) ret = mnt_want_write_file(dst_file); if (ret) { info->status = ret; - goto next_loop; + goto next_fdput; } dst_off = info->dest_offset; @@ -2058,9 +2058,9 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same) next_file: mnt_drop_write_file(dst_file); -next_loop: +next_fdput: fdput(dst_fd); - +next_loop: if (fatal_signal_pending(current)) goto out; }