mirror of
https://github.com/torvalds/linux.git
synced 2026-10-11 21:07:03 +02:00
ksmbd: fix off-by-one rejecting minimal COPYCHUNK query-limits request
The FSCTL_COPYCHUNK/FSCTL_COPYCHUNK_WRITE input length check uses in_buf_len <= sizeof(struct copychunk_ioctl_req), which rejects a buffer that is exactly sizeof(struct copychunk_ioctl_req) bytes -- the minimal, valid request containing only the fixed header with ChunkCount=0 and no chunk entries, used by clients to query the server's copy limits before issuing a real copychunk. Since copychunk_ioctl_req ends in a flexible array member, the correct minimum is that the buffer covers the fixed header, so use offsetof(..., Chunks) with '<' instead of '<=' against sizeof(): same value, but the boundary case is now correctly accepted. Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Gael Blivet <gael.blivet@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
f4ce7da9b3
commit
d68d4b3293
|
|
@ -9329,7 +9329,7 @@ int smb2_ioctl(struct ksmbd_work *work)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (in_buf_len <= sizeof(struct copychunk_ioctl_req)) {
|
||||
if (in_buf_len < offsetof(struct copychunk_ioctl_req, Chunks)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user