android_kernel_motorola_sm6225/fs/nfs
Jeffrey Mitchell 345c6f260c nfs: Fix security label length not being reset
[ Upstream commit d33030e2ee3508d65db5644551435310df86010e ]

nfs_readdir_page_filler() iterates over entries in a directory, reusing
the same security label buffer, but does not reset the buffer's length.
This causes decode_attr_security_label() to return -ERANGE if an entry's
security label is longer than the previous one's. This error, in
nfs4_decode_dirent(), only gets passed up as -EAGAIN, which causes another
failed attempt to copy into the buffer. The second error is ignored and
the remaining entries do not show up in ls, specifically the getdents64()
syscall.

Reproduce by creating multiple files in NFS and giving one of the later
files a longer security label. ls will not see that file nor any that are
added afterwards, though they will exist on the backend.

In nfs_readdir_page_filler(), reset security label buffer length before
every reuse

Signed-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>
Fixes: b4487b935452 ("nfs: Fix getxattr kernel panic and memory overflow")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-07 08:00:07 +02:00
..
blocklayout NFS: Mark expected switch fall-throughs 2018-08-08 16:50:02 -04:00
filelayout PNFS fallback to MDS if no deviceid found 2019-05-25 18:23:28 +02:00
flexfilelayout pNFS/flexfiles: Fix list corruption if the mirror count changes 2020-06-30 23:17:18 -04:00
cache_lib.c NFS client updates for Linux 4.15 2017-11-17 14:18:00 -08:00
cache_lib.h NFS client updates for Linux 4.15 2017-11-17 14:18:00 -08:00
callback.c NFS client updates for Linux 4.15 2017-11-17 14:18:00 -08:00
callback.h NFS CB_OFFLOAD xdr 2018-08-09 12:56:38 -04:00
callback_proc.c NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid() 2020-04-23 10:30:18 +02:00
callback_xdr.c NFS CB_OFFLOAD xdr 2018-08-09 12:56:38 -04:00
client.c nfs: add minor version to nfs_server_key for fscache 2020-04-02 15:28:14 +02:00
delegation.c NFS: Fix a soft lockup in the delegation recovery code 2020-01-27 14:50:27 +01:00
delegation.h NFS: Fix a soft lockup in the delegation recovery code 2020-01-27 14:50:27 +01:00
dir.c nfs: Fix security label length not being reset 2020-10-07 08:00:07 +02:00
direct.c SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion") 2020-07-29 10:16:46 +02:00
dns_resolve.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dns_resolve.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
export.c NFS: Pass the inode down to the getattr() callback 2018-06-04 12:07:07 -04:00
file.c SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion") 2020-07-29 10:16:46 +02:00
fscache-index.c nfs: fscache: use timespec64 in inode auxdata 2020-05-20 08:18:43 +02:00
fscache.c NFSv4: Fix fscache cookie aux_data to ensure change_attr is included 2020-05-20 08:18:43 +02:00
fscache.h nfs: fscache: use timespec64 in inode auxdata 2020-05-20 08:18:43 +02:00
getroot.c
inode.c NFSv4: Handle the special Linux file open access mode 2019-07-26 09:14:22 +02:00
internal.h Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
io.c NFS: Fix a race between mmap() and O_DIRECT 2018-01-28 22:00:15 -05:00
iostat.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig nfs: NFS_SWAP should depend on SWAP 2020-02-14 16:33:23 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mount_clnt.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namespace.c NFS: Use ERR_CAST() to avoid cross-structure cast 2017-05-28 10:11:47 -07:00
netns.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs2super.c
nfs2xdr.c NFSv2: Fix a typo in encode_sattr() 2020-01-17 19:47:04 +01:00
nfs3_fs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs3acl.c nfs: Fix potential posix_acl refcnt leak in nfs3_set_acl 2020-05-06 08:13:32 +02:00
nfs3client.c
nfs3proc.c NFS: Pass the inode down to the getattr() callback 2018-06-04 12:07:07 -04:00
nfs3super.c
nfs3xdr.c NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() 2020-02-14 16:33:24 -05:00
nfs4_fs.h NFSv4: Fix a potential sleep while atomic in nfs4_do_reclaim() 2019-08-29 08:28:38 +02:00
nfs4client.c nfs: add minor version to nfs_server_key for fscache 2020-04-02 15:28:14 +02:00
nfs4file.c NFSv4: Fix return values for nfs4_file_open() 2019-09-21 07:16:55 +02:00
nfs4getroot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs4idmap.c keys: Fix dependency loop between construction record and auth key 2019-03-23 20:09:48 +01:00
nfs4idmap.h
nfs4namespace.c nfs: Referrals should use the same proto setting as their parent 2018-01-14 23:06:30 -05:00
nfs4proc.c NFS: Zero-stateid SETATTR should first return delegation 2020-09-23 12:10:58 +02:00
nfs4renewd.c
nfs4session.c
nfs4session.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs4state.c NFSv4: Ensure that the state manager exits the loop on SIGKILL 2019-11-06 13:05:29 +01:00
nfs4super.c
nfs4sysctl.c nfs: Do not convert nfs_idmap_cache_timeout to jiffies 2018-01-18 15:10:47 -05:00
nfs4trace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs4trace.h NFSv4: Fix a tracepoint Oops in initiate_file_draining() 2018-09-14 16:24:08 -04:00
nfs4xdr.c nfs: Fix getxattr kernel panic and memory overflow 2020-08-21 11:05:38 +02:00
nfs42.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfs42proc.c NFS: Fix memory leaks 2020-02-24 08:34:53 +01:00
nfs42xdr.c NFS: Add missing encode / decode sequence_maxsz to v4.2 operations 2020-01-27 14:50:29 +01:00
nfsroot.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfstrace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nfstrace.h NFS client updates for Linux 4.16 2018-01-30 19:03:48 -08:00
pagelist.c NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests() 2020-10-01 13:14:41 +02:00
pnfs.c NFS: Don't return layout segments that are in use 2020-08-19 08:15:06 +02:00
pnfs.h NFS/pnfs: Bulk destroy of layouts needs to be safe w.r.t. umount 2020-01-27 14:50:27 +01:00
pnfs_dev.c pnfs/blocklayout: handle transient devices 2018-01-14 23:06:29 -05:00
pnfs_nfs.c NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() 2020-02-14 16:33:24 -05:00
proc.c NFSv2: Fix write regression 2019-09-21 07:17:02 +02:00
read.c NFS: Pass error information to the pgio error cleanup routine 2019-09-06 10:22:23 +02:00
super.c fs/nfs: Fix nfs_parse_devname to not modify it's argument 2020-01-27 14:50:26 +01:00
symlink.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sysctl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
unlink.c NFS: Fix up sillyrename() 2018-05-31 15:02:16 -04:00
write.c NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests() 2020-10-01 13:14:41 +02:00