cifs: Fix connections leak when tlink setup failed
authorZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Fri, 11 Nov 2022 07:12:12 +0000 (15:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:40:59 +0000 (17:40 +0100)
commita9059e338fc000c0b87d8cf29e93c74fd703212e
treeda99c55d3c95a1188bd1976ae61f4f46781b8b8b
parent81d583baa5f1abd73c755ce1992929debd20b687
cifs: Fix connections leak when tlink setup failed

[ Upstream commit 1dcdf5f5b2137185cbdd5385f29949ab3da4f00c ]

If the tlink setup failed, lost to put the connections, then
the module refcnt leak since the cifsd kthread not exit.

Also leak the fscache info, and for next mount with fsc, it will
print the follow errors:
  CIFS: Cache volume key already in use (cifs,127.0.0.1:445,TEST)

Let's check the result of tlink setup, and do some cleanup.

Fixes: 56c762eb9bee ("cifs: Refactor out cifs_mount()")
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/connect.c