提交 9b99303a 编写于 作者: L Long Li

ksmbd: validate command request size

mainline inclusion
from mainline-v6.5-rc4
commit 5aa4fda5aa9c2a5a7bac67b4a12b089ab81fee3c
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I7LU3O
CVE: CVE-2023-38432

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5aa4fda5aa9c2a5a7bac67b4a12b089ab81fee3c

--------------------------------

In commit 2b9b8f3b ("ksmbd: validate command payload size"), except
for SMB2_OPLOCK_BREAK_HE command, the request size of other commands
is not checked, it's not expected. Fix it by add check for request
size of other commands.

Cc: stable@vger.kernel.org
Fixes: 2b9b8f3b ("ksmbd: validate command payload size")
Acked-by: NNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: NLong Li <leo.lilong@huawei.com>
Signed-off-by: NSteve French <stfrench@microsoft.com>

Conflicts:
	fs/ksmbd/smb2misc.c
Signed-off-by: NLong Li <leo.lilong@huawei.com>
上级 719cbf47
...@@ -379,13 +379,13 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work) ...@@ -379,13 +379,13 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
} }
if (smb2_req_struct_sizes[command] != pdu->StructureSize2) { if (smb2_req_struct_sizes[command] != pdu->StructureSize2) {
if (command == SMB2_OPLOCK_BREAK_HE && if (!(command == SMB2_OPLOCK_BREAK_HE &&
le16_to_cpu(pdu->StructureSize2) != OP_BREAK_STRUCT_SIZE_20 && (le16_to_cpu(pdu->StructureSize2) == OP_BREAK_STRUCT_SIZE_20 ||
le16_to_cpu(pdu->StructureSize2) != OP_BREAK_STRUCT_SIZE_21) { le16_to_cpu(pdu->StructureSize2) == OP_BREAK_STRUCT_SIZE_21))) {
/* special case for SMB2.1 lease break message */ /* special case for SMB2.1 lease break message */
ksmbd_debug(SMB, ksmbd_debug(SMB,
"Illegal request size %d for oplock break\n", "Illegal request size %u for command %d\n",
le16_to_cpu(pdu->StructureSize2)); le16_to_cpu(pdu->StructureSize2), command);
return 1; return 1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册