summaryrefslogtreecommitdiff
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2021-06-24 15:28:04 -0500
committerSteve French <stfrench@microsoft.com>2021-06-24 16:09:10 -0500
commit0060a4f28a9ef45ae8163c0805e944a2b1546762 (patch)
tree8f0c78103b3d3c2051927deed1e430e90f297ad2 /fs/cifs/connect.c
parent162004a2f7ef5c77600e364dc4e9315b0e6ca386 (diff)
cifs: fix missing spinlock around update to ses->status
In the other places where we update ses->status we protect the updates via GlobalMid_Lock. So to be consistent add the same locking around it in cifs_put_smb_ses where it was missing. Addresses-Coverity: 1268904 ("Data race condition") Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index c8079376d294..5d269f583dac 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1598,9 +1598,12 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
spin_unlock(&cifs_tcp_ses_lock);
return;
}
+ spin_unlock(&cifs_tcp_ses_lock);
+
+ spin_lock(&GlobalMid_Lock);
if (ses->status == CifsGood)
ses->status = CifsExiting;
- spin_unlock(&cifs_tcp_ses_lock);
+ spin_unlock(&GlobalMid_Lock);
cifs_free_ipc(ses);