diff options
| author | Dudu Lu <phx0fer@gmail.com> | 2026-04-15 18:24:24 +0800 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-04-15 17:27:58 -0500 |
| commit | 6b83b03c07fbe0b57bb729bee91ae44c623c82ff (patch) | |
| tree | ffa7dbb1ef05257279357b37a0bd8a1fd8207a57 /drivers/staging/bcm/git@git.tavy.me:linux.git | |
| parent | abce65948c2cd9f4d36ea0a57e79b9885b9801c6 (diff) | |
smb: client: fix integer underflow in receive_encrypted_read()
In receive_encrypted_read(), the length of data to read from the socket
is computed as:
len = le32_to_cpu(tr_hdr->OriginalMessageSize) -
server->vals->read_rsp_size;
OriginalMessageSize comes from the server's transform header and is
untrusted. If a malicious server sends a value smaller than
read_rsp_size, the unsigned subtraction wraps to a very large value
(~4GB). This value is then passed to netfs_alloc_folioq_buffer() and
cifs_read_iter_from_socket(), causing either a massive allocation
attempt that fails with -ENOMEM (DoS), or under extreme memory
pressure, potential heap corruption.
Fix by adding a check that OriginalMessageSize is at least
read_rsp_size before the subtraction. On failure, jump to
discard_data to drain the remaining PDU from the socket, preventing
desync of subsequent reads on the connection.
Signed-off-by: Dudu Lu <phx0fer@gmail.com>
Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'drivers/staging/bcm/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
