mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ksmbd: add low bound validation to FSCTL_SET_ZERO_DATA
[ Upstream commit2d74ec9713] Smatch static checker warning: fs/ksmbd/smb2pdu.c:7759 smb2_ioctl() warn: no lower bound on 'off' Fix unexpected result that could caused from negative off and bfz. Fixes:b5e5f9dfc9("ksmbd: check invalid FileOffset and BeyondFinalZero in FSCTL_ZERO_DATA") 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:
committed by
Greg Kroah-Hartman
parent
82268b2da2
commit
bd344dc3bb
@@ -7764,7 +7764,7 @@ int smb2_ioctl(struct ksmbd_work *work)
|
||||
|
||||
off = le64_to_cpu(zero_data->FileOffset);
|
||||
bfz = le64_to_cpu(zero_data->BeyondFinalZero);
|
||||
if (off > bfz) {
|
||||
if (off < 0 || bfz < 0 || off > bfz) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user