summaryrefslogtreecommitdiffstats
path: root/fs/smb
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2023-08-25 23:39:40 +0900
committerSteve French <stfrench@microsoft.com>2023-08-29 12:30:20 -0500
commit17d5b135bb720832364e8f55f6a887a3c7ec8fdb (patch)
tree8a9a1dab246e2aa488dbc58b48b2998146cd327b /fs/smb
parentbf26f1b4e0918f017775edfeacf6d867204b680b (diff)
downloadlinux-17d5b135bb720832364e8f55f6a887a3c7ec8fdb.tar.gz
linux-17d5b135bb720832364e8f55f6a887a3c7ec8fdb.tar.bz2
linux-17d5b135bb720832364e8f55f6a887a3c7ec8fdb.zip
ksmbd: fix wrong DataOffset validation of create context
If ->DataOffset of create context is 0, DataBuffer size is not correctly validated. This patch change wrong validation code and consider tag length in request. Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21824 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/server/oplock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c
index 6bc8a1e48171..9bc0103720f5 100644
--- a/fs/smb/server/oplock.c
+++ b/fs/smb/server/oplock.c
@@ -1481,7 +1481,7 @@ struct create_context *smb2_find_context_vals(void *open_req, const char *tag, i
name_len < 4 ||
name_off + name_len > cc_len ||
(value_off & 0x7) != 0 ||
- (value_off && (value_off < name_off + name_len)) ||
+ (value_len && value_off < name_off + (name_len < 8 ? 8 : name_len)) ||
((u64)value_off + value_len > cc_len))
return ERR_PTR(-EINVAL);