summaryrefslogtreecommitdiff
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2021-11-19 17:16:57 +0300
committerSteve French <stfrench@microsoft.com>2022-01-19 20:10:54 +0300
commit88b024f556fcd5bf1288c6333016f576cfa5f539 (patch)
tree26e936c19c55aa2484d3ae6c4c23e9fde3ff0d2d /fs/cifs/smb2pdu.c
parenta05885ce13bd5ec9602551e32dfb1a4f26bfa542 (diff)
downloadlinux-88b024f556fcd5bf1288c6333016f576cfa5f539.tar.xz
cifs: protect all accesses to chan_* with chan_lock
A spin lock called chan_lock was introduced recently. But not all accesses were protected. Doing that with this change. To make sure that a channel is not freed when in use, we need to introduce a ref count. But today, we don't ever free channels. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 6d8cfe15fbaf..ca8a16896f17 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -244,10 +244,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
spin_unlock(&ses->chan_lock);
return 0;
}
+ spin_unlock(&ses->chan_lock);
cifs_dbg(FYI, "sess reconnect mask: 0x%lx, tcon reconnect: %d",
tcon->ses->chans_need_reconnect,
tcon->need_reconnect);
- spin_unlock(&ses->chan_lock);
nls_codepage = load_nls_default();
@@ -3835,11 +3835,13 @@ void smb2_reconnect_server(struct work_struct *work)
* binding session, but tcon is healthy (some other channel
* is active)
*/
+ spin_lock(&ses->chan_lock);
if (!tcon_selected && cifs_chan_needs_reconnect(ses, server)) {
list_add_tail(&ses->rlist, &tmp_ses_list);
ses_selected = ses_exist = true;
ses->ses_count++;
}
+ spin_unlock(&ses->chan_lock);
}
/*
* Get the reference to server struct to be sure that the last call of