diff mbox series

[1/2] cifs: Fix lost destroy smbd connection when MR allocate failed

Message ID 20221118084208.3214951-2-zhangxiaoxu5@huawei.com (mailing list archive)
State New, archived
Headers show
Series cifs: Fix resource leak when MR allocate failed | expand

Commit Message

Zhang Xiaoxu Nov. 18, 2022, 8:42 a.m. UTC
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: c7398583340a ("CIFS: SMBD: Implement RDMA memory registration")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 fs/cifs/smbdirect.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
index 90789aaa6567..a874c2e1ae41 100644
--- a/fs/cifs/smbdirect.c
+++ b/fs/cifs/smbdirect.c
@@ -1699,6 +1699,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;