linux-stable/fs/nfs
Zhang Xiaoxu aae35a0c8a nfs4: Fix kmemleak when allocate slot failed
[ Upstream commit 7e8436728e ]

If one of the slot allocate failed, should cleanup all the other
allocated slots, otherwise, the allocated slots will leak:

  unreferenced object 0xffff8881115aa100 (size 64):
    comm ""mount.nfs"", pid 679, jiffies 4294744957 (age 115.037s)
    hex dump (first 32 bytes):
      00 cc 19 73 81 88 ff ff 00 a0 5a 11 81 88 ff ff  ...s......Z.....
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
      [<000000007a4c434a>] nfs4_find_or_create_slot+0x8e/0x130
      [<000000005472a39c>] nfs4_realloc_slot_table+0x23f/0x270
      [<00000000cd8ca0eb>] nfs40_init_client+0x4a/0x90
      [<00000000128486db>] nfs4_init_client+0xce/0x270
      [<000000008d2cacad>] nfs4_set_client+0x1a2/0x2b0
      [<000000000e593b52>] nfs4_create_server+0x300/0x5f0
      [<00000000e4425dd2>] nfs4_try_get_tree+0x65/0x110
      [<00000000d3a6176f>] vfs_get_tree+0x41/0xf0
      [<0000000016b5ad4c>] path_mount+0x9b3/0xdd0
      [<00000000494cae71>] __x64_sys_mount+0x190/0x1d0
      [<000000005d56bdec>] do_syscall_64+0x35/0x80
      [<00000000687c9ae4>] entry_SYSCALL_64_after_hwframe+0x46/0xb0

Fixes: abf79bb341 ("NFS: Add a slot table to struct nfs_client for NFSv4.0 transport blocking")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-10 15:47:20 +01:00
..
blocklayout
filelayout NFS: fix an incorrect limit in filelayout_decode_layout() 2021-06-03 08:36:18 +02:00
flexfilelayout pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds 2021-11-26 11:40:34 +01:00
cache_lib.c
cache_lib.h
callback.c
callback.h NFSv4.1: Fix uninitialised variable in devicenotify 2022-02-16 12:44:49 +01:00
callback_proc.c NFSv4/pNFS: Fix another issue with a list iterator pointing to the head 2022-04-20 09:08:21 +02:00
callback_xdr.c NFS: remove unneeded check in decode_devicenotify_args() 2022-04-20 09:08:20 +02:00
client.c NFS: Fix initialisation of nfs_client cl_flags field 2022-02-16 12:44:49 +01:00
delegation.c NFS: Fix a soft lockup in the delegation recovery code 2020-01-27 14:46:21 +01:00
delegation.h NFS: Fix a soft lockup in the delegation recovery code 2020-01-27 14:46:21 +01:00
dir.c NFS: LOOKUP_DIRECTORY is also ok with symlinks 2022-02-23 11:57:35 +01:00
direct.c NFS: swap-out must always use STABLE writes. 2022-04-20 09:08:28 +02:00
dns_resolve.c
dns_resolve.h
export.c
file.c NFS: swap IO handling is slightly different for O_DIRECT IO 2022-04-20 09:08:28 +02:00
fscache-index.c
fscache.c
fscache.h
getroot.c
inode.c NFS: Do not report writeback errors in nfs_getattr() 2022-02-23 11:57:36 +01:00
internal.h NFS: nfs_igrab_and_active must first reference the superblock 2021-01-23 15:48:44 +01:00
io.c
iostat.h
Kconfig nfs: fix PNFS_FLEXFILE_LAYOUT Kconfig default 2021-03-30 14:40:08 +02:00
Makefile
mount_clnt.c
namespace.c NFS: fix nfs_path in case of a rename retry 2020-11-05 11:06:59 +01:00
netns.h
nfs.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c nfs: Fix potential posix_acl refcnt leak in nfs3_set_acl 2020-05-05 19:15:52 +02:00
nfs3client.c
nfs3proc.c nfs: fix acl memory leak of posix_acl_create() 2021-07-20 16:17:53 +02:00
nfs3super.c
nfs3xdr.c NFS: Correct size calculation for create reply length 2021-03-30 14:40:08 +02:00
nfs4_fs.h NFSv4 expose nfs_parse_server_name function 2022-02-16 12:44:49 +01:00
nfs4client.c nfs4: Fix kmemleak when allocate slot failed 2022-11-10 15:47:20 +01:00
nfs4file.c NFSv4: Fix v4.0/v4.1 SEEK_DATA return -ENOTSUPP when set NFS_V4_2 config 2021-06-03 08:36:18 +02:00
nfs4getroot.c
nfs4idmap.c NFSv4: Fix races in the legacy idmapper upcall 2022-08-25 11:11:32 +02:00
nfs4idmap.h
nfs4namespace.c NFSv4 expose nfs_parse_server_name function 2022-02-16 12:44:49 +01:00
nfs4proc.c NFSv4.1: RECLAIM_COMPLETE must handle EACCES 2022-08-25 11:11:32 +02:00
nfs4renewd.c
nfs4session.c
nfs4session.h
nfs4state.c NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot 2022-11-10 15:47:20 +01:00
nfs4super.c
nfs4sysctl.c
nfs4trace.c
nfs4trace.h
nfs4xdr.c NFSv4 remove zero number of fs_locations entries error check 2022-02-16 12:44:49 +01:00
nfs42.h
nfs42proc.c NFSv42: Fix pagecache invalidation after COPY/CLONE 2021-12-08 08:46:53 +01:00
nfs42xdr.c NFSv42: Don't fail clone() unless the OP_CLONE operation failed 2021-12-08 08:46:48 +01:00
nfsroot.c
nfstrace.c
nfstrace.h
pagelist.c NFS: Don't corrupt the value of pg_bytes_written in nfs_do_recoalesce() 2021-06-03 08:36:18 +02:00
pnfs.c pNFS: Don't keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE 2022-06-25 11:46:43 +02:00
pnfs.h NFSv4/pNFS: Fix another issue with a list iterator pointing to the head 2022-04-20 09:08:21 +02:00
pnfs_dev.c
pnfs_nfs.c pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds 2021-11-26 11:40:34 +01:00
proc.c NFSv2: Fix write regression 2019-09-21 07:15:37 +02:00
read.c NFS: Pass error information to the pgio error cleanup routine 2019-09-06 10:21:00 +02:00
super.c fs/nfs: Fix nfs_parse_devname to not modify it's argument 2020-01-27 14:46:21 +01:00
symlink.c
sysctl.c
unlink.c
write.c NFS: Fix deadlocks in nfs_scan_commit_list() 2021-11-26 11:40:34 +01:00