]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
cifs: fix session state check in smb2_find_smb_ses
authorWinston Wen <wentao@uniontech.com>
Mon, 26 Jun 2023 03:42:57 +0000 (11:42 +0800)
committerSteve French <stfrench@microsoft.com>
Wed, 28 Jun 2023 16:47:46 +0000 (11:47 -0500)
Chech the session state and skip it if it's exiting.

Signed-off-by: Winston Wen <wentao@uniontech.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2transport.c

index 790acf65a0926cbe3316d591a3bc7a1b97120974..22954a9c7a6c7633f8a48422b98b57291c06843e 100644 (file)
@@ -153,7 +153,14 @@ smb2_find_smb_ses_unlocked(struct TCP_Server_Info *server, __u64 ses_id)
        list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
                if (ses->Suid != ses_id)
                        continue;
+
+               spin_lock(&ses->ses_lock);
+               if (ses->ses_status == SES_EXITING) {
+                       spin_unlock(&ses->ses_lock);
+                       continue;
+               }
                ++ses->ses_count;
+               spin_unlock(&ses->ses_lock);
                return ses;
        }