android_kernel_xiaomi_sm7250/fs/nfs
Zhang Xiaoxu 86ce0e93cf nfs4: Fix kmemleak when allocate slot failed
[ Upstream commit 7e8436728e22181c3f12a5dbabd35ed3a8b8c593 ]

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 17:46:51 +01:00
..
blocklayout
filelayout
flexfilelayout
cache_lib.c
cache_lib.h
callback_proc.c NFSv4/pNFS: Fix another issue with a list iterator pointing to the head 2022-04-15 14:14:53 +02:00
callback_xdr.c NFS: remove unneeded check in decode_devicenotify_args() 2022-04-15 14:14:52 +02:00
callback.c
callback.h NFSv4.1: Fix uninitialised variable in devicenotify 2022-02-16 12:51:44 +01:00
client.c NFS: Fix initialisation of nfs_client cl_flags field 2022-02-16 12:51:43 +01:00
delegation.c
delegation.h
dir.c NFS: LOOKUP_DIRECTORY is also ok with symlinks 2022-02-23 11:58:40 +01:00
direct.c NFS: swap-out must always use STABLE writes. 2022-04-15 14:15:03 +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-15 14:15:03 +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:58:40 +01:00
internal.h
io.c
iostat.h
Kconfig
Makefile
mount_clnt.c
namespace.c
netns.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c
nfs3client.c
nfs3proc.c
nfs3super.c
nfs3xdr.c
nfs4_fs.h NFSv4 expose nfs_parse_server_name function 2022-02-16 12:51:44 +01:00
nfs4client.c nfs4: Fix kmemleak when allocate slot failed 2022-11-10 17:46:51 +01:00
nfs4file.c
nfs4getroot.c
nfs4idmap.c NFSv4: Fix races in the legacy idmapper upcall 2022-08-25 11:15:36 +02:00
nfs4idmap.h
nfs4namespace.c NFSv4 expose nfs_parse_server_name function 2022-02-16 12:51:44 +01:00
nfs4proc.c NFSv4/pnfs: Fix a use-after-free bug in open 2022-08-25 11:15:37 +02:00
nfs4renewd.c
nfs4session.c
nfs4session.h
nfs4state.c NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot 2022-11-10 17:46:51 +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:51:44 +01:00
nfs42.h
nfs42proc.c NFSv42: Fix pagecache invalidation after COPY/CLONE 2021-12-08 08:50:11 +01:00
nfs42xdr.c NFSv42: Don't fail clone() unless the OP_CLONE operation failed 2021-12-01 09:27:42 +01:00
nfs.h
nfsroot.c
nfstrace.c
nfstrace.h
pagelist.c
pnfs_dev.c
pnfs_nfs.c
pnfs.c pNFS: Don't keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE 2022-06-25 11:49:15 +02:00
pnfs.h NFSv4/pNFS: Fix another issue with a list iterator pointing to the head 2022-04-15 14:14:53 +02:00
proc.c
read.c
super.c
symlink.c
sysctl.c
unlink.c
write.c