summaryrefslogtreecommitdiff
path: root/fs/smb
diff options
context:
space:
mode:
authorWinston Wen <wentao@uniontech.com>2023-06-26 11:42:57 +0800
committerSteve French <stfrench@microsoft.com>2023-06-28 11:47:46 -0500
commit66be5c48ee1b5b8c919cc329fe6d32e16badaa40 (patch)
tree6018b99d254dda18290bf2a2f301521acc2841e4 /fs/smb
parent99f280700b4cc02d5f141b8d15f8e9fad0418f65 (diff)
cifs: fix session state check in smb2_find_smb_ses
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>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/client/smb2transport.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index 790acf65a092..22954a9c7a6c 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -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;
}