linux-stable/fs/nfsd
Jeff Layton 51ddb84baf nfsd: don't replace page in rq_pages if it's a continuation of last page
[ Upstream commit 27c934dd88 ]

The splice read calls nfsd_splice_actor to put the pages containing file
data into the svc_rqst->rq_pages array. It's possible however to get a
splice result that only has a partial page at the end, if (e.g.) the
filesystem hands back a short read that doesn't cover the whole page.

nfsd_splice_actor will plop the partial page into its rq_pages array and
return. Then later, when nfsd_splice_actor is called again, the
remainder of the page may end up being filled out. At this point,
nfsd_splice_actor will put the page into the array _again_ corrupting
the reply. If this is done enough times, rq_next_page will overrun the
array and corrupt the trailing fields -- the rq_respages and
rq_next_page pointers themselves.

If we've already added the page to the array in the last pass, don't add
it to the array a second time when dealing with a splice continuation.
This was originally handled properly in nfsd_splice_actor, but commit
91e23b1c39 ("NFSD: Clean up nfsd_splice_actor()") removed the check
for it.

Fixes: 91e23b1c39 ("NFSD: Clean up nfsd_splice_actor()")
Cc: Al Viro <viro@zeniv.linux.org.uk>
Reported-by: Dario Lesca <d.lesca@solinos.it>
Tested-by: David Critch <dcritch@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2150630
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-30 12:49:04 +02:00
..
acl.h NFSD: add posix ACLs to struct nfsd_attrs 2022-08-04 10:28:03 -04:00
auth.c
auth.h
blocklayout.c block: remove genhd.h 2022-02-02 07:49:59 -07:00
blocklayoutxdr.c
blocklayoutxdr.h
cache.h nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_reply_cache_stats_fops 2022-09-26 14:02:50 -04:00
current_stateid.h
export.c fs: add is_idmapped_mnt() helper 2021-12-03 18:44:06 +01:00
export.h nfsd: report per-export stats 2021-01-25 09:36:28 -05:00
fault_inject.c
filecache.c nfsd: don't fsync nfsd_files on last close 2023-03-10 09:33:25 +01:00
filecache.h nfsd: fix handling of cached open files in nfsd4_open codepath 2023-01-18 11:58:26 +01:00
flexfilelayout.c nfsd: use correct format characters 2022-03-17 19:47:38 -04:00
flexfilelayoutxdr.c
flexfilelayoutxdr.h
idmap.h
Kconfig NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
lockd.c NFSD: simplify struct nfsfh 2021-10-02 15:51:10 -04:00
Makefile NFSD: Remove CONFIG_NFSD_V3 2022-03-11 10:25:14 -05:00
netns.h NFSD: add shrinker to reap courtesy clients on low memory condition 2022-09-26 14:02:41 -04:00
nfs2acl.c NFSD: Finish converting the NFSv2 GETACL result encoder 2022-12-31 13:31:58 +01:00
nfs3acl.c NFSD: Finish converting the NFSv3 GETACL result encoder 2022-12-31 13:31:58 +01:00
nfs3proc.c NFSD: Add an NFSD_FILE_GC flag to enable nfsd_file garbage collection 2023-01-18 11:58:25 +01:00
nfs3xdr.c NFSD: Clean up WRITE arg decoders 2022-09-26 14:02:47 -04:00
nfs4acl.c NFSD: add posix ACLs to struct nfsd_attrs 2022-08-04 10:28:03 -04:00
nfs4callback.c nfsd: under NFSv4.1, fix double svc_xprt_put on rpc_create failure 2022-12-31 13:32:53 +01:00
nfs4idmap.c NFSD: move from strlcpy with unused retval to strscpy 2022-09-26 14:02:20 -04:00
nfs4layouts.c nfsd: fix race to check ls_layouts 2023-03-10 09:33:24 +01:00
nfs4proc.c nfsd: zero out pointers after putting nfsd_files on COPY setup error 2023-03-10 09:34:01 +01:00
nfs4recover.c struct file-related stuff 2022-10-06 17:13:18 -07:00
nfs4state.c nfsd: don't hand out delegation on setuid files being opened for write 2023-03-10 09:34:01 +01:00
nfs4xdr.c Revert "SUNRPC: Use RMW bitops in single-threaded hot paths" 2023-01-14 10:33:42 +01:00
nfscache.c nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_reply_cache_stats_fops 2022-09-26 14:02:50 -04:00
nfsctl.c NFSD: unregister shrinker when nfsd_init_net() fails 2022-10-11 10:08:26 -04:00
nfsd.h NFSD: add shrinker to reap courtesy clients on low memory condition 2022-09-26 14:02:41 -04:00
nfsfh.c nfsd: ensure we always call fh_verify_error tracepoint 2022-10-13 12:12:37 -04:00
nfsfh.h NFSD: discard fh_locked flag and fh_lock/fh_unlock 2022-08-04 10:28:48 -04:00
nfsproc.c NFSD: Refactor common code out of dirlist helpers 2022-09-26 14:02:47 -04:00
nfssvc.c NFSD: copy the whole verifier in nfsd_copy_write_verifier 2023-03-10 09:33:25 +01:00
nfsxdr.c NFSD: Clean up WRITE arg decoders 2022-09-26 14:02:47 -04:00
pnfs.h
state.h nfsd: make nfsd4_run_cb a bool return function 2022-09-26 14:50:57 -04:00
stats.c nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops 2022-09-26 14:02:49 -04:00
stats.h nfsd: make nfsd_stats.th_cnt atomic_t 2021-12-13 13:42:51 -05:00
trace.c
trace.h nfsd: don't fsync nfsd_files on last close 2023-03-10 09:33:25 +01:00
vfs.c nfsd: don't replace page in rq_pages if it's a continuation of last page 2023-03-30 12:49:04 +02:00
vfs.h NFSD: Pass the target nfsd_file to nfsd_commit() 2023-01-18 11:58:25 +01:00
xdr.h NFSD: prevent underflow in nfssvc_decode_writeargs() 2022-03-15 09:35:56 -04:00
xdr3.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4.h NFSD: enhance inter-server copy cleanup 2023-03-10 09:33:24 +01:00
xdr4cb.h