diff options
author | Daniel Berlin <[email protected]> | 2023-10-10 14:04:32 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2023-10-10 19:19:09 -0700 |
commit | 810fc49a3eb16647c905d02bd4f945e1e4332251 (patch) | |
tree | 43b23f1b313d05c52f890aebfc96d1b08c0b96be /module | |
parent | 75a7740574e119b40b7f4144d1d3928d3a5c9b98 (diff) |
Ensure we call fput when cloning fails due to different devices.
Right now, zpl_ioctl_ficlone and zpl_ioctl_ficlonerange do not call
put on the src fd if the source and destination are on two different
devices. This leaves the source file held open in this case.
Reviewed-by: Kay Pedersen <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Daniel Berlin <[email protected]>
Closes #15386
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/zpl_file_range.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/module/os/linux/zfs/zpl_file_range.c b/module/os/linux/zfs/zpl_file_range.c index 2abbf44df..c47fe99da 100644 --- a/module/os/linux/zfs/zpl_file_range.c +++ b/module/os/linux/zfs/zpl_file_range.c @@ -202,8 +202,10 @@ zpl_ioctl_ficlone(struct file *dst_file, void *arg) if (src_file == NULL) return (-EBADF); - if (dst_file->f_op != src_file->f_op) + if (dst_file->f_op != src_file->f_op) { + fput(src_file); return (-EXDEV); + } size_t len = i_size_read(file_inode(src_file)); @@ -237,8 +239,10 @@ zpl_ioctl_ficlonerange(struct file *dst_file, void __user *arg) if (src_file == NULL) return (-EBADF); - if (dst_file->f_op != src_file->f_op) + if (dst_file->f_op != src_file->f_op) { + fput(src_file); return (-EXDEV); + } size_t len = fcr.fcr_src_length; if (len == 0) |