ksmbd: validate command request size
In commit2b9b8f3b68
("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:2b9b8f3b68
("ksmbd: validate command payload size") Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Long Li <leo.lilong@huawei.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
5d0c230f1d
commit
5aa4fda5aa
|
@ -380,13 +380,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue