diff options
author | Namjae Jeon | 2023-03-05 21:04:00 +0900 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-03-30 12:49:09 +0200 |
commit | bd344dc3bbf086f4c9175de3d1d0753e28ea7fdf (patch) | |
tree | aa6f31ec4dc2801e71114d222ec8c578c05ea756 /fs | |
parent | 82268b2da28a8a1fbf6b04ef8e3e0dbe4e16237e (diff) |
ksmbd: add low bound validation to FSCTL_SET_ZERO_DATA
[ Upstream commit 2d74ec97131b1179a373b6d521f195c84e894eb6 ]
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: b5e5f9dfc915 ("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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ksmbd/smb2pdu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 0f0f1243a9cb..3bb971831e7c 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -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; } |