mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-16 19:04:41 +08:00
ksmbd: add low bound validation to FSCTL_QUERY_ALLOCATED_RANGES
[ Upstream commit342edb60dc
] Smatch static checker warning: fs/ksmbd/vfs.c:1040 ksmbd_vfs_fqar_lseek() warn: no lower bound on 'length' fs/ksmbd/vfs.c:1041 ksmbd_vfs_fqar_lseek() warn: no lower bound on 'start' Fix unexpected result that could caused from negative start and length. Fixes:f441584858
("cifsd: add file operations") Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d897216325
commit
96039c44ae
@ -7415,13 +7415,16 @@ static int fsctl_query_allocated_ranges(struct ksmbd_work *work, u64 id,
|
||||
if (in_count == 0)
|
||||
return -EINVAL;
|
||||
|
||||
start = le64_to_cpu(qar_req->file_offset);
|
||||
length = le64_to_cpu(qar_req->length);
|
||||
|
||||
if (start < 0 || length < 0)
|
||||
return -EINVAL;
|
||||
|
||||
fp = ksmbd_lookup_fd_fast(work, id);
|
||||
if (!fp)
|
||||
return -ENOENT;
|
||||
|
||||
start = le64_to_cpu(qar_req->file_offset);
|
||||
length = le64_to_cpu(qar_req->length);
|
||||
|
||||
ret = ksmbd_vfs_fqar_lseek(fp, start, length,
|
||||
qar_rsp, in_count, out_count);
|
||||
if (ret && ret != -E2BIG)
|
||||
|
Loading…
Reference in New Issue
Block a user