[PATCH] vfs: fix early copy_file_range return when len is zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The early return from copy_file_range when len is zero should check if the
filesystem really implements this syscall, returning -EOPNOTSUPP if it doesn't,
and 0 otherwise.

Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
Signed-off-by: Luis Henriques <lhenriques@xxxxxxx>
---
Hi!

Since I got not feedback, I'm sending a patch that should fix this issue
reported by 0day.  Probably this should simply be squashed into v9, I can
send v10 if you prefer that.

Cheers,
--
Luis

 fs/read_write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index 9db7adf160d2..24b4bf704765 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1498,7 +1498,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
 		return ret;
 
 	if (len == 0)
-		return 0;
+		return file_out->f_op->copy_file_range ? 0 : -EOPNOTSUPP;
 
 	file_start_write(file_out);
 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux