nfsd: don't ignore high bits of copy count

[ Upstream commit e7a833e9cc6c3b58fe94f049d2b40943cba07086 ]

Note size_t is 32-bit on a 32-bit architecture, but cp_count is defined
by the protocol to be 64 bit, so we could be turning a large copy into a
0-length copy here.

Reported-by: <radchenkoy@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
J. Bruce Fields
2021-03-18 20:03:22 -04:00
committed by Greg Kroah-Hartman
parent 1f76b1e659
commit 14b13e0603

View File

@@ -1376,7 +1376,7 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy)
struct file *dst = copy->nf_dst->nf_file;
struct file *src = copy->nf_src->nf_file;
ssize_t bytes_copied = 0;
size_t bytes_total = copy->cp_count;
u64 bytes_total = copy->cp_count;
u64 src_pos = copy->cp_src_pos;
u64 dst_pos = copy->cp_dst_pos;