]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
nfsd: don't ignore high bits of copy count
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 19 Mar 2021 00:03:22 +0000 (20:03 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 22 Mar 2021 14:19:04 +0000 (10:19 -0400)
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>
fs/nfsd/nfs4proc.c

index d7b100a1e306ba5870a319459c5b83752fdb26cd..edcb380fbf126d53db8283a8aa543151432f8baa 100644 (file)
@@ -1383,7 +1383,7 @@ static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync)
 static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy)
 {
        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;