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 31DC0354ADD; Fri, 13 Feb 2026 13:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770990580; cv=none; b=QLw5FSn09B1Kmx2Mijtg4iVd6wEQTYwGjj9n3CpvuYPr5exO8bWlXEVRabFayv9Iws/RF9CQz982IVXpor6LDnw8Jce1xSvDeAaRhNHnjK7553vN8wOALdbJIAjppVukYjTPCbD8PwPYnyTiw5qaBRLMJtrL4P8F0dcFRhAUM+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770990580; c=relaxed/simple; bh=WyqX83VNel/SCL8Yq+kIC/F+no7X8vxge3cGFlU1Bgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AKtJBxWZ/CgCV7pJMxvYB7pwEm6Wnvg9eCQTUDOxIT04FDe8YlOBTx0QWqu9ze3/WcPXW09Y1aBp8q2BiKGOsOOzWQSy+i5ZTBmoyNIjjwUeOs6J36lUUOukhcD3AQH2v71Kl7Qt1uNWjblFXTSGjNLR9NTecG/aFQ6qr+Mu0KY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YxUEpy2V; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YxUEpy2V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B984C116C6; Fri, 13 Feb 2026 13:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770990579; bh=WyqX83VNel/SCL8Yq+kIC/F+no7X8vxge3cGFlU1Bgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YxUEpy2VYqU3akAHk0e4p6cN9YPIhx3cre4Uc9vL9xDikKW6XLcH4sF2m0364PQla 8Hd9e3wVibIcUrjGwFHMjMs9uJBfpPs8mvjEtUjux1oMLyp6cYA0BrTCy1YZVkq54W ynXR1o9Sjd2tPT0a/6n0h0yXXuLxjDbSEwIWE5YE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Namjae Jeon , Steve French , Tom Talpey , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, Stefan Metzmacher , Steve French Subject: [PATCH 6.19 13/49] smb: server: let send_done handle a completion without IB_SEND_SIGNALED Date: Fri, 13 Feb 2026 14:47:32 +0100 Message-ID: <20260213134709.213345996@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260213134708.713126210@linuxfoundation.org> References: <20260213134708.713126210@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Metzmacher commit 9da82dc73cb03e85d716a2609364572367a5ff47 upstream. With smbdirect_send_batch processing we likely have requests without IB_SEND_SIGNALED, which will be destroyed in the final request that has IB_SEND_SIGNALED set. If the connection is broken all requests are signaled even without explicit IB_SEND_SIGNALED. Cc: # 6.18.x Cc: Namjae Jeon Cc: Steve French Cc: Tom Talpey Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/server/transport_rdma.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) --- a/fs/smb/server/transport_rdma.c +++ b/fs/smb/server/transport_rdma.c @@ -1059,6 +1059,31 @@ static void send_done(struct ib_cq *cq, ib_wc_status_msg(wc->status), wc->status, wc->opcode); + if (unlikely(!(sendmsg->wr.send_flags & IB_SEND_SIGNALED))) { + /* + * This happens when smbdirect_send_io is a sibling + * before the final message, it is signaled on + * error anyway, so we need to skip + * smbdirect_connection_free_send_io here, + * otherwise is will destroy the memory + * of the siblings too, which will cause + * use after free problems for the others + * triggered from ib_drain_qp(). + */ + if (wc->status != IB_WC_SUCCESS) + goto skip_free; + + /* + * This should not happen! + * But we better just close the + * connection... + */ + pr_err("unexpected send completion wc->status=%s (%d) wc->opcode=%d\n", + ib_wc_status_msg(wc->status), wc->status, wc->opcode); + smb_direct_disconnect_rdma_connection(sc); + return; + } + /* * Free possible siblings and then the main send_io */ @@ -1072,6 +1097,7 @@ static void send_done(struct ib_cq *cq, lcredits += 1; if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_SEND) { +skip_free: pr_err("Send error. status='%s (%d)', opcode=%d\n", ib_wc_status_msg(wc->status), wc->status, wc->opcode);