* [PATCH] smb: client: delete compound mids on send failure before unlock
@ 2026-09-19 10:57 Adarsh Das
0 siblings, 0 replies; only message in thread
From: Adarsh Das @ 2026-09-19 10:57 UTC (permalink / raw)
To: linux-cifs
Cc: pc, linkinjeon, ronniesahlberg, sprasad, tom, bharathsm,
samba-technical, linux-kernel, Adarsh Das,
syzbot+eeb58d2197d88720a228
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@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
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-19 10:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-19 10:57 [PATCH] smb: client: delete compound mids on send failure before unlock Adarsh Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®