Skip to content

Commit 78f1688

Browse files
Marios Makassikissmfrench
authored andcommitted
ksmbd: Fix buffer length check in fsctl_validate_negotiate_info()
The validate_negotiate_info_req struct definition includes an extra field to access the data coming after the header. This causes the check in fsctl_validate_negotiate_info() to count the first element of the array twice. This in turn makes some valid requests fail, depending on whether they include padding or not. Fixes: f7db8fd ("ksmbd: add validation in smb2_ioctl") Cc: [email protected] # v5.15 Acked-by: Namjae Jeon <[email protected]> Acked-by: Hyunchul Lee <[email protected]> Signed-off-by: Marios Makassikis <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent e8d585b commit 78f1688

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7313,7 +7313,7 @@ static int fsctl_validate_negotiate_info(struct ksmbd_conn *conn,
73137313
int ret = 0;
73147314
int dialect;
73157315

7316-
if (in_buf_len < sizeof(struct validate_negotiate_info_req) +
7316+
if (in_buf_len < offsetof(struct validate_negotiate_info_req, Dialects) +
73177317
le16_to_cpu(neg_req->DialectCount) * sizeof(__le16))
73187318
return -EINVAL;
73197319

0 commit comments

Comments
 (0)