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 A5FD754723; Fri, 13 Feb 2026 13:52:27 +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=1770990747; cv=none; b=NAsDiMflSqbT3/mhxjodUAUGO0KLmnHkiXQPBTuKvftHIoUg/kyc78LcCwdmm4XCEogbDy+wq8oeFqsWvohxqxMjwKFnzvY/AMRTfmiPuo3Z1J70RRx3gCGvtGp8/cH0Hk0ZVyoDm3NTjahwmheNQjEOFxhsN0uqBkZVRgD/nHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770990747; c=relaxed/simple; bh=7H+GJ/DGbCEawWuqZpq1599EvkhT5PXK0P0SoSuNM5o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=szJia4JRjgk/6xdmQZlSWoDHOGuLaig06DJKhSIn4XrHtnWnSN6ioR5+hcV2bmhyg9kYQRtJVXE1wb0L3FYYNFB9nC0+kHPoAKYm1Af7qlu8sQH3y6h3KqaGIqIuWFLWamCOWWo9z6FuQBCmxIta9/ZuM6QyGOMD6V9QOIeEDnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cdhpLiIW; 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="cdhpLiIW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11FA6C116C6; Fri, 13 Feb 2026 13:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770990747; bh=7H+GJ/DGbCEawWuqZpq1599EvkhT5PXK0P0SoSuNM5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdhpLiIWHF2r7prif2LjFX3K0iR8BaQvmFylBczhJdR/rg0CsUiq3pkLE6d9jGcCm 7wyGEt0U4uLBRFgqy6nsJrNoGnvl6ff1H8v0AE9mG22w6y9iQRqnzFyhTqkfDNe61A 9r2+XX/puq7iQcTUFkKG1599ACDpLEY8xNHHxsKQ= 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.18 13/49] smb: server: let send_done handle a completion without IB_SEND_SIGNALED Date: Fri, 13 Feb 2026 14:47:57 +0100 Message-ID: <20260213134709.373513166@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260213134708.885500854@linuxfoundation.org> References: <20260213134708.885500854@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.18-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 @@ -957,6 +957,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 */ @@ -970,6 +995,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);