NFSD: Watch for rq_pages bounds checking errors in nfsd_splice_actor()
authorChuck Lever <chuck.lever@oracle.com>
Fri, 17 Mar 2023 21:09:20 +0000 (17:09 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 26 Apr 2023 13:05:01 +0000 (09:05 -0400)
commit0f5162480bd25bd97b91c9153db7afbd89698804
treea273f9e1648e80256d5e4b9321f624d0a9424cd4
parent376bcd9b37632cf191711a68aa25ab42f0048c2e
NFSD: Watch for rq_pages bounds checking errors in nfsd_splice_actor()

There have been several bugs over the years where the NFSD splice
actor has attempted to write outside the rq_pages array.

This is a "should never happen" condition, but if for some reason
the pipe splice actor should attempt to walk past the end of
rq_pages, it needs to terminate the READ operation to prevent
corruption of the pointer addresses in the fields just beyond the
array.

A server crash is thus prevented. Since the code is not behaving,
the READ operation returns -EIO to the client. None of the READ
payload data can be trusted if the splice actor isn't operating as
expected.

Suggested-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
fs/nfsd/vfs.c
include/linux/sunrpc/svc.h
include/trace/events/sunrpc.h
net/sunrpc/svc.c