From: Zhang Xiaoxu Date: Fri, 18 Nov 2022 08:42:07 +0000 (+0800) Subject: cifs: Fix lost destroy smbd connection when MR allocate failed X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=46cd6c639cddba2bd2d810ceb16bb20374ad75b0;p=linux.git cifs: Fix lost destroy smbd connection when MR allocate failed [ 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: c7398583340a ("CIFS: SMBD: Implement RDMA memory registration") Signed-off-by: Zhang Xiaoxu Acked-by: Paulo Alcantara (SUSE) Reviewed-by: David Howells Reviewed-by: Tom Talpey Signed-off-by: Steve French Signed-off-by: Sasha Levin --- diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index cb93cccbf0c41..58f086aabc888 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1702,6 +1702,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;