From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 725A88489 for ; Fri, 10 Mar 2023 14:19:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4414C4339B; Fri, 10 Mar 2023 14:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678457973; bh=/ZEPAqWSWrmyOv7ODG7U+jvTaRGVKBkNlip8bjX/8uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDEl3HVERVJQeJho9Yq08Kboh5QKqVsQEJBVZzwoQJyI5JGwzkIjcSVOWLaKLj9f6 7SyuIX8L/VlNFTbL4GxglJSie8wVi5E3gtQ7Ekx3fPFxQWW+DA1uiGH1r1xsLGFHSz CE2IhwGcLbWsLo65378c6fH2Mrd5LcTXYi+ZWv2A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhang Xiaoxu , "Paulo Alcantara (SUSE)" , David Howells , Tom Talpey , Steve French , Sasha Levin Subject: [PATCH 4.19 091/252] cifs: Fix lost destroy smbd connection when MR allocate failed Date: Fri, 10 Mar 2023 14:37:41 +0100 Message-Id: <20230310133721.577840715@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133718.803482157@linuxfoundation.org> References: <20230310133718.803482157@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Zhang Xiaoxu [ 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 --- fs/cifs/smbdirect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 591cd5c704323..de11b52a04dee 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1887,6 +1887,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; -- 2.39.2