Patch "ksmbd: fix a missing return value check bug" has been added to the 6.1-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 a missing return value check bug

to the 6.1-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-a-missing-return-value-check-bug.patch
and it can be found in the queue-6.1 subdirectory.

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



commit ac68886161040b5ea76b3da7fa7f1bbaf3904b53
Author: Wentao Liang <liangwentao@xxxxxxxxxxx>
Date:   Mon Dec 23 23:30:50 2024 +0800

    ksmbd: fix a missing return value check bug
    
    [ Upstream commit 4c16e1cadcbcaf3c82d5fc310fbd34d0f5d0db7c ]
    
    In the smb2_send_interim_resp(), if ksmbd_alloc_work_struct()
    fails to allocate a node, it returns a NULL pointer to the
    in_work pointer. This can lead to an illegal memory write of
    in_work->response_buf when allocate_interim_rsp_buf() attempts
    to perform a kzalloc() on it.
    
    To address this issue, incorporating a check for the return
    value of ksmbd_alloc_work_struct() ensures that the function
    returns immediately upon allocation failure, thereby preventing
    the aforementioned illegal memory access.
    
    Fixes: 041bba4414cd ("ksmbd: fix wrong interim response on compound")
    Signed-off-by: Wentao Liang <liangwentao@xxxxxxxxxxx>
    Acked-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/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 71478a590e83..9d041fc558e3 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -712,6 +712,9 @@ void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status)
 	struct smb2_hdr *rsp_hdr;
 	struct ksmbd_work *in_work = ksmbd_alloc_work_struct();
 
+	if (!in_work)
+		return;
+
 	if (allocate_interim_rsp_buf(in_work)) {
 		pr_err("smb_allocate_rsp_buf failed!\n");
 		ksmbd_free_work_struct(in_work);




[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