]> git.ipfire.org Git - thirdparty/linux.git/commit
NFSD: Add array bounds-checking in nfsd_iter_read()
authorChuck Lever <chuck.lever@oracle.com>
Wed, 17 Sep 2025 14:31:40 +0000 (10:31 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 16 Nov 2025 23:20:11 +0000 (18:20 -0500)
commitccd608e29b7a73b7bee45b06bfeef088a97c4c92
treecfd27556159a76fdebebc47221c08a5047bb85d4
parentb5fc406bc730806662429272300fb56e4e6592d8
NFSD: Add array bounds-checking in nfsd_iter_read()

The *count parameter does not appear to be explicitly restricted
to being smaller than rsize, so it might be possible to overrun
the rq_bvec or rq_pages arrays.

Rather than overrunning these arrays (damage done!) and then WARNING
once, let's harden the loop so that it terminates before the end of
the arrays are reached. This should result in a short read, which is
OK -- clients recover by sending additional READ requests for the
remaining unread bytes.

Reported-by: NeilBrown <neil@brown.name>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/vfs.c