5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jordy Zomer <jordyzomer@xxxxxxxxxx> [ Upstream commit fc342cf86e2dc4d2edb0fc2ff5e28b6c7845adb9 ] 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@xxxxxxxxxxxxxxx # v5.15+ Reported-by: Jordy Zomer <jordyzomer@xxxxxxxxxx> Signed-off-by: Jordy Zomer <jordyzomer@xxxxxxxxxx> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> --- fs/ksmbd/smb2pdu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 54f7cf7a98b2..35914c9809aa 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -6350,6 +6350,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.39.5