[PATCH 01/20] cifs: Fix MID entry leak in receive_encrypted_standard()
From: Wentao Liang
Date: Wed Sep 16 2026 - 03:06:12 EST
In receive_encrypted_standard(), mid_entry is obtained from
smb2_find_mid(). When the compound PDU count exceeds MAX_COMPOUND,
the function returns -1 without releasing the acquired mid_entry
reference, resulting in a resource leak.
Release the mid_entry before returning error when *num_mids exceeds
MAX_COMPOUND.
Fixes: b24df3e30cbf ("cifs: update receive_encrypted_standard to handle compounded responses")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
fs/smb/client/smb2ops.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 61b60114e4b8..7208f6c84e34 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -5122,6 +5122,8 @@ receive_encrypted_standard(struct TCP_Server_Info *server,
if (*num_mids >= MAX_COMPOUND) {
cifs_server_dbg(VFS, "too many PDUs in compound\n");
+ if (mid_entry)
+ release_mid(server, mid_entry);
return -1;
}
bufs[*num_mids] = buf;
--
2.34.1