]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: Fix lost destroy smbd connection when MR allocate failed
authorZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Fri, 18 Nov 2022 08:42:07 +0000 (16:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:49 +0000 (16:43 +0100)
[ Upstream commit e9d3401d95d62a9531082cd2453ed42f2740e3fd ]

If the MR allocate failed, the smb direct connection info is NULL,
then smbd_destroy() will directly return, then the connection info
will be leaked.

Let's set the smb direct connection info to the server before call
smbd_destroy().

Fixes: 7b3a72c2f9ee ("CIFS: SMBD: Implement RDMA memory registration")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Acked-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Tom Talpey <tom@talpey.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/smbdirect.c

index 2cea6c25d1b0ecbd528a5d5ede3da9ff4c63e716..66265e7303cd4f7491fd79536abd6852d84ff10f 100644 (file)
@@ -1784,6 +1784,7 @@ static struct smbd_connection *_smbd_get_connection(
 
 allocate_mr_failed:
        /* At this point, need to a full transport shutdown */
+       server->smbd_conn = info;
        smbd_destroy(server);
        return NULL;