ksmbd: add low bound validation to FSCTL_QUERY_ALLOCATED_RANGES
authorNamjae Jeon <linkinjeon@kernel.org>
Tue, 7 Mar 2023 12:56:07 +0000 (21:56 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2023 10:47:49 +0000 (12:47 +0200)
commit96039c44ae475709b3758265f0899fe2b4a95c65
tree16399a6fb857f73a19df9f84e95c3808c92ad50e
parentd897216325d7f6cf4feecbdea8025e12d374cd98
ksmbd: add low bound validation to FSCTL_QUERY_ALLOCATED_RANGES

[ Upstream commit 342edb60dcda7a409430359b0cac2864bb9dfe44 ]

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: f44158485826 ("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>
fs/ksmbd/smb2pdu.c