From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Adarsh Das <adarshdas950@gmail.com>,
syzbot+eeb58d2197d88720a228@syzkaller.appspotmail.com,
Paulo Alcantara <pc@manguebit.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.12.y 3/3] smb: client: delete compound mids on send failure before unlock
Date: Wed, 30 Sep 2026 14:50:06 -0400 [thread overview]
Message-ID: <20260930185006.338236-3-sashal@kernel.org> (raw)
In-Reply-To: <20260930185006.338236-1-sashal@kernel.org>
From: Adarsh Das <adarshdas950@gmail.com>
[ Upstream commit 8f6f8a48399f82f4a83f7b9f25b9707e0062a4f9 ]
When sending a compound request fails, smb_send_rqst() kicks off a
reconnect. compound_send_recv() still has those mids on pending_mid_q,
but it unlocks the server without removing them first.
During reconnect, cifs_abort_connection() walks pending_mid_q and runs
each mid callback. With no response yet, those callbacks return credits
and drop in_flight. Then compound_send_recv()'s send-error path returns
the same credits again. in_flight ends up decremented twice and
smb2_add_credits() WARNs.
syzbot hits this during SMB2_negotiate when the socket send fails.
cifs_call_async() already calls delete_mid() before unlock on send
failure. Do the same for compound chains and set cancelled_mid[] so the
out: path does not delete them again.
Fixes: ee258d79159a ("CIFS: Move credit processing to mid callbacks for SMB3")
Reported-by: syzbot+eeb58d2197d88720a228@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6a727d22.40259c87.584f4.04ce.GAE@google.com
Tested-by: syzbot+eeb58d2197d88720a228@syzkaller.appspotmail.com
Assisted-by: LLM
Cc: stable@vger.kernel.org
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/transport.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index f3eb7c6b641d1..ec22ce90c0f60 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -1183,6 +1183,10 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
if (rc < 0) {
revert_current_mid(server, num_rqst);
server->sequence_number -= 2;
+ for (i = 0; i < num_rqst; i++) {
+ delete_mid(server, mid[i]);
+ cancelled_mid[i] = true;
+ }
}
cifs_server_unlock(server);
--
2.53.0
prev parent reply other threads:[~2026-09-30 18:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 11:53 FAILED: patch "[PATCH] smb: client: delete compound mids on send failure before" failed to apply to 6.12-stable tree gregkh
2026-09-30 18:50 ` [PATCH 6.12.y 1/3] cifs: Remove the RFC1002 header from smb_hdr Sasha Levin
2026-09-30 18:50 ` [PATCH 6.12.y 2/3] cifs: Fix specification of function pointers Sasha Levin
2026-09-30 18:50 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930185006.338236-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=adarshdas950@gmail.com \
--cc=pc@manguebit.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+eeb58d2197d88720a228@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.