NFSD: Clamp WRITE offsets
authorChuck Lever <chuck.lever@oracle.com>
Tue, 25 Jan 2022 21:36:22 +0000 (16:36 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Feb 2022 11:54:17 +0000 (12:54 +0100)
commit3a6a2d43e32a363a23e8ef60d57187aefaeef377
treefd6329645d7ca5125237df988a2c1f8b552b8479
parentc72f7c2ec3d4d53a15de0282c64e1235b12c95eb
NFSD: Clamp WRITE offsets

commit 6260d9a56ab352b54891ec66ab0eced57d55abc6 upstream.

Ensure that a client cannot specify a WRITE range that falls in a
byte range outside what the kernel's internal types (such as loff_t,
which is signed) can represent. The kiocb iterators, invoked in
nfsd_vfs_write(), should properly limit write operations to within
the underlying file system's s_maxbytes.

Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs3proc.c
fs/nfsd/nfs4proc.c