Patch "ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ksmbd-fix-slab-out-of-bounds-in-smb_strndup_from_utf.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1d1854317e5b7cf9f6498d4a7dfcb3141e0c74a5
Author: Namjae Jeon <linkinjeon@xxxxxxxxxx>
Date:   Sat Mar 16 23:36:36 2024 +0900

    ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()
    
    [ Upstream commit d10c77873ba1e9e6b91905018e29e196fd5f863d ]
    
    If ->NameOffset/Length is bigger than ->CreateContextsOffset/Length,
    ksmbd_check_message doesn't validate request buffer it correctly.
    So slab-out-of-bounds warning from calling smb_strndup_from_utf16()
    in smb2_open() could happen. If ->NameLength is non-zero, Set the larger
    of the two sums (Name and CreateContext size) as the offset and length of
    the data area.
    
    Reported-by: Yang Chaoming <lometsj@xxxxxxxx>
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/smb/server/smb2misc.c b/fs/smb/server/smb2misc.c
index 03dded29a9804..7c872ffb4b0a9 100644
--- a/fs/smb/server/smb2misc.c
+++ b/fs/smb/server/smb2misc.c
@@ -107,7 +107,10 @@ static int smb2_get_data_area_len(unsigned int *off, unsigned int *len,
 	case SMB2_CREATE:
 	{
 		unsigned short int name_off =
-			le16_to_cpu(((struct smb2_create_req *)hdr)->NameOffset);
+			max_t(unsigned short int,
+			      le16_to_cpu(((struct smb2_create_req *)hdr)->NameOffset),
+			      offsetof(struct smb2_create_req, Buffer));
+
 		unsigned short int name_len =
 			le16_to_cpu(((struct smb2_create_req *)hdr)->NameLength);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux