[PATCH] smb: client: delete compound mids on send failure before unlock

From: Adarsh Das

Date: Sat Sep 19 2026 - 06:58:37 EST


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.

Reported-by: syzbot+eeb58d2197d88720a228@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://lore.kernel.org/r/6a727d22.40259c87.584f4.04ce.GAE@xxxxxxxxxx
Tested-by: syzbot+eeb58d2197d88720a228@xxxxxxxxxxxxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Adarsh Das <adarshdas950@xxxxxxxxx>
---
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 e266859818a4..7df5b3447aea 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -965,6 +965,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);