Patch "cifs: fix session state check in reconnect to avoid use-after-free issue" has been added to the 6.4-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

    cifs: fix session state check in reconnect to avoid use-after-free issue

to the 6.4-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:
     cifs-fix-session-state-check-in-reconnect-to-avoid-u.patch
and it can be found in the queue-6.4 subdirectory.

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



commit b90ab7a1b09367d279343de4a49c698a3b6731e6
Author: Winston Wen <wentao@xxxxxxxxxxxxx>
Date:   Mon Jun 26 11:42:56 2023 +0800

    cifs: fix session state check in reconnect to avoid use-after-free issue
    
    [ Upstream commit 99f280700b4cc02d5f141b8d15f8e9fad0418f65 ]
    
    Don't collect exiting session in smb2_reconnect_server(), because it
    will be released soon.
    
    Note that the exiting session will stay in server->smb_ses_list until
    it complete the cifs_free_ipc() and logoff() and then delete itself
    from the list.
    
    Signed-off-by: Winston Wen <wentao@xxxxxxxxxxxxx>
    Reviewed-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 17fe212ab895d..e04766fe6f803 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -3797,6 +3797,12 @@ void smb2_reconnect_server(struct work_struct *work)
 
 	spin_lock(&cifs_tcp_ses_lock);
 	list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
+		spin_lock(&ses->ses_lock);
+		if (ses->ses_status == SES_EXITING) {
+			spin_unlock(&ses->ses_lock);
+			continue;
+		}
+		spin_unlock(&ses->ses_lock);
 
 		tcon_selected = false;
 



[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