[SRU][N][PATCH 1/1] ksmbd: fix Out-of-Bounds Read in ksmbd_vfs_stream_read

Massimiliano Pellizzer massimiliano.pellizzer at canonical.com
Sat Feb 15 16:24:26 UTC 2025


From: Jordy Zomer <jordyzomer at google.com>

CVE-2024-56627

An offset from client could be a negative value, It could lead
to an out-of-bounds read from the stream_buf.
Note that this issue is coming when setting
'vfs objects = streams_xattr parameter' in ksmbd.conf.

Cc: stable at vger.kernel.org # v5.15+
Reported-by: Jordy Zomer <jordyzomer at google.com>
Signed-off-by: Jordy Zomer <jordyzomer at google.com>
Signed-off-by: Namjae Jeon <linkinjeon at kernel.org>
Signed-off-by: Steve French <stfrench at microsoft.com>
(cherry picked from commit fc342cf86e2dc4d2edb0fc2ff5e28b6c7845adb9)
Signed-off-by: Massimiliano Pellizzer <massimiliano.pellizzer at canonical.com>
---
 fs/smb/server/smb2pdu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index a452abc4bb96..bff2e17aa0ba 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -6420,6 +6420,10 @@ int smb2_read(struct ksmbd_work *work)
 	}
 
 	offset = le64_to_cpu(req->Offset);
+	if (offset < 0) {
+		err = -EINVAL;
+		goto out;
+	}
 	length = le32_to_cpu(req->Length);
 	mincount = le32_to_cpu(req->MinimumCount);
 
-- 
2.43.0




More information about the kernel-team mailing list