linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range()
@ 2018-04-14  6:16 Zev Weiss
  2018-04-14  7:55 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Zev Weiss @ 2018-04-14  6:16 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Darrick J . Wong, linux-fsdevel, linux-kernel, Zev Weiss

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>
---
 fs/read_write.c | 6 +++---
 1 file 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)
 		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;
 	}
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range()
  2018-04-14  6:16 [PATCH] fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range() Zev Weiss
@ 2018-04-14  7:55 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2018-04-14  7:55 UTC (permalink / raw)
  To: Zev Weiss; +Cc: Darrick J . Wong, linux-fsdevel, linux-kernel

On Sat, Apr 14, 2018 at 01:16:58AM -0500, Zev Weiss wrote:
> 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.

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-14  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-14  6:16 [PATCH] fs: avoid fdput() after failed fdget() in vfs_dedupe_file_range() Zev Weiss
2018-04-14  7:55 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).