ksmbd: add low bound validation to FSCTL_SET_ZERO_DATA
authorNamjae Jeon <linkinjeon@kernel.org>
Sun, 5 Mar 2023 12:04:00 +0000 (21:04 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:49:09 +0000 (12:49 +0200)
commitbd344dc3bbf086f4c9175de3d1d0753e28ea7fdf
treeaa6f31ec4dc2801e71114d222ec8c578c05ea756
parent82268b2da28a8a1fbf6b04ef8e3e0dbe4e16237e
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>
fs/ksmbd/smb2pdu.c