kernel_samsung_a53x/fs/nfsd
Chuck Lever cc51856c28 NFSD: Fix READDIR buffer overflow
[ Upstream commit 53b1119a6e5028b125f431a0116ba73510d82a72 ]

If a client sends a READDIR count argument that is too small (say,
zero), then the buffer size calculation in the new init_dirlist
helper functions results in an underflow, allowing the XDR stream
functions to write beyond the actual buffer.

This calculation has always been suspect. NFSD has never sanity-
checked the READDIR count argument, but the old entry encoders
managed the problem correctly.

With the commits below, entry encoding changed, exposing the
underflow to the pointer arithmetic in xdr_reserve_space().

Modern NFS clients attempt to retrieve as much data as possible
for each READDIR request. Also, we have no unit tests that
exercise the behavior of READDIR at the lower bound of @count
values. Thus this case was missed during testing.

Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Fixes: f5dcccd647da ("NFSD: Update the NFSv2 READDIR entry encoder to use struct xdr_stream")
Fixes: 7f87fc2d34d4 ("NFSD: Update NFSv3 READDIR entry encoders to use struct xdr_stream")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:49 +01:00
..
acl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
auth.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
auth.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
blocklayout.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
blocklayoutxdr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
blocklayoutxdr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
current_stateid.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c nfsd: report per-export stats 2024-11-19 12:27:31 +01:00
export.h nfsd: report per-export stats 2024-11-19 12:27:31 +01:00
fault_inject.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
filecache.c fsnotify: Protect fsnotify_handle_inode_event from no-inode events 2024-11-19 12:27:46 +01:00
filecache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flexfilelayout.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flexfilelayoutxdr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flexfilelayoutxdr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
idmap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig NFSv4.2: Remove ifdef CONFIG_NFSD from NFSv4.2 client SSC code. 2024-11-19 12:27:37 +01:00
lockd.c Keep read and write fds with each nlm_file 2024-11-19 12:27:44 +01:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
netns.h NFSD: delay unmount source's export after inter-server copy completed. 2024-11-19 12:27:39 +01:00
nfs2acl.c SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
nfs3acl.c SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
nfs3proc.c NFSD: Fix READDIR buffer overflow 2024-11-19 12:27:49 +01:00
nfs3xdr.c SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
nfs4acl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nfs4callback.c nfsd: rpc_peeraddr2str needs rcu lock 2024-11-19 12:27:39 +01:00
nfs4idmap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nfs4layouts.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nfs4proc.c NFSD: Save location of NFSv4 COMPOUND status 2024-11-19 12:27:48 +01:00
nfs4recover.c nfsd: Log client tracking type log message as info instead of warning 2024-11-19 12:27:36 +01:00
nfs4state.c NFSD: Initialize pointer ni with NULL and not plain integer 0 2024-11-19 12:27:48 +01:00
nfs4xdr.c NFSD: Fix exposure in nfsd4_decode_bitmap() 2024-11-19 12:27:49 +01:00
nfscache.c NFSD: Optimize DRC bucket pruning 2024-11-19 12:27:47 +01:00
nfsctl.c nfsd: Fix fall-through warnings for Clang 2024-11-19 12:27:37 +01:00
nfsd.h SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
nfsfh.c NFSD: Update the GETATTR3res encoder to use struct xdr_stream 2024-11-19 12:27:33 +01:00
nfsfh.h NFSD: Constify @fh argument of knfsd_fh_hash() 2024-11-19 12:27:38 +01:00
nfsproc.c NFSD: Fix READDIR buffer overflow 2024-11-19 12:27:49 +01:00
nfssvc.c NFSD:fix boolreturn.cocci warning 2024-11-19 12:27:48 +01:00
nfsxdr.c SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
pnfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
state.h nfsd: track filehandle aliasing in nfs4_files 2024-11-19 12:27:37 +01:00
stats.c nfsd: protect concurrent access to nfsd stats counters 2024-11-19 12:27:31 +01:00
stats.h nfsd: report per-export stats 2024-11-19 12:27:31 +01:00
trace.c NFSD: Add SPDX header for fs/nfsd/trace.c 2024-11-19 12:27:20 +01:00
trace.h NFSD: Prevent a possible oops in the nfs_dirent() tracepoint 2024-11-19 12:27:41 +01:00
vfs.c nfsd4: remove obselete comment 2024-11-19 12:27:48 +01:00
vfs.h NFSD: Update the NFSv3 ACCESS3res encoder to use struct xdr_stream 2024-11-19 12:27:33 +01:00
xdr.h SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
xdr3.h SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
xdr4.h SUNRPC: Change return value type of .pc_encode 2024-11-19 12:27:48 +01:00
xdr4cb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00