Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22762711 authored by Zev Weiss's avatar Zev Weiss Committed by Al Viro
Browse files

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: default avatarZev Weiss <zev@bewilderbeest.net>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 60cc43fc
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -2023,7 +2023,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
		ret = mnt_want_write_file(dst_file);
		ret = mnt_want_write_file(dst_file);
		if (ret) {
		if (ret) {
			info->status = ret;
			info->status = ret;
			goto next_loop;
			goto next_fdput;
		}
		}


		dst_off = info->dest_offset;
		dst_off = info->dest_offset;
@@ -2058,9 +2058,9 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)


next_file:
next_file:
		mnt_drop_write_file(dst_file);
		mnt_drop_write_file(dst_file);
next_loop:
next_fdput:
		fdput(dst_fd);
		fdput(dst_fd);

next_loop:
		if (fatal_signal_pending(current))
		if (fatal_signal_pending(current))
			goto out;
			goto out;
	}
	}