summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLong Li <leo.lilong@huawei.com>2023-07-29 11:36:18 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-16 18:27:20 +0200
commitc6bef3bc30fd4a175aef846b7d928a6c40d091cd (patch)
treeeaca50961122b0a80e3f9fd8c0275a2ec4fa5c21 /fs
parentccb1700ed60653d99bce29f3b62091e7c14858e3 (diff)
downloadlinux-stable-c6bef3bc30fd4a175aef846b7d928a6c40d091cd.tar.gz
linux-stable-c6bef3bc30fd4a175aef846b7d928a6c40d091cd.tar.bz2
linux-stable-c6bef3bc30fd4a175aef846b7d928a6c40d091cd.zip
ksmbd: validate command request size
commit 5aa4fda5aa9c2a5a7bac67b4a12b089ab81fee3c upstream. In commit 2b9b8f3b68ed ("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: 2b9b8f3b68ed ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/server/smb2misc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/smb/server/smb2misc.c b/fs/smb/server/smb2misc.c
index 33b7e6c4ceff..e881df1d10cb 100644
--- a/fs/smb/server/smb2misc.c
+++ b/fs/smb/server/smb2misc.c
@@ -380,13 +380,13 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
}
if (smb2_req_struct_sizes[command] != pdu->StructureSize2) {
- 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_21) {
+ 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_21))) {
/* special case for SMB2.1 lease break message */
ksmbd_debug(SMB,
- "Illegal request size %d for oplock break\n",
- le16_to_cpu(pdu->StructureSize2));
+ "Illegal request size %u for command %d\n",
+ le16_to_cpu(pdu->StructureSize2), command);
return 1;
}
}