mainline inclusion from mainline-v6.12-rc3 commit 313dab082289e460391c82d855430ec8a28ddf81 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBEAP7 CVE: CVE-2024-56626
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
An offset from client could be a negative value, It could allows to write data outside the bounds of the allocated buffer. Note that this issue is coming when setting 'vfs objects = streams_xattr parameter' in ksmbd.conf.
Cc: stable@vger.kernel.org # v5.15+ Reported-by: Jordy Zomer jordyzomer@google.com Signed-off-by: Jordy Zomer jordyzomer@google.com Signed-off-by: Namjae Jeon linkinjeon@kernel.org Signed-off-by: Steve French stfrench@microsoft.com Conflicts: fs/smb/server/smb2pdu.c fs/ksmbd/smb2pdu.c [Location and context differences.] Signed-off-by: Sun Yongjian sunyongjian1@huawei.com --- fs/ksmbd/smb2pdu.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index f104de64493b..cc8c136d8862 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -6570,6 +6570,8 @@ int smb2_write(struct ksmbd_work *work) }
offset = le64_to_cpu(req->Offset); + if (offset < 0) + return -EINVAL; length = le32_to_cpu(req->Length);
if (length > work->conn->vals->max_write_size) {