summaryrefslogtreecommitdiff
path: root/fs/smb/client/smb2ops.c
diff options
context:
space:
mode:
authorHaoxiang Li <haoxiang_li2024@163.com>2025-02-17 15:20:38 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-27 04:10:53 -0800
commit9e5d99a4cf2e23c716b44862975548415fae5391 (patch)
tree26f54bc3b62c6dd67263cfaf62613988aa1639d9 /fs/smb/client/smb2ops.c
parent8380ebc6f91b5905e31502bbf4b7ae60168287f7 (diff)
smb: client: Add check for next_buffer in receive_encrypted_standard()
commit 860ca5e50f73c2a1cef7eefc9d39d04e275417f7 upstream. Add check for the return value of cifs_buf_get() and cifs_small_buf_get() in receive_encrypted_standard() to prevent null pointer dereference. Fixes: eec04ea11969 ("smb: client: fix OOB in receive_encrypted_standard()") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/smb/client/smb2ops.c')
-rw-r--r--fs/smb/client/smb2ops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 8d3fa2a3b8a9..b809a616728f 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -4905,6 +4905,10 @@ one_more:
next_buffer = (char *)cifs_buf_get();
else
next_buffer = (char *)cifs_small_buf_get();
+ if (!next_buffer) {
+ cifs_server_dbg(VFS, "No memory for (large) SMB response\n");
+ return -1;
+ }
memcpy(next_buffer, buf + next_cmd, pdu_length - next_cmd);
}