diff options
author | Shyam Prasad N <sprasad@microsoft.com> | 2021-11-19 17:16:57 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-01-19 20:10:54 +0300 |
commit | 88b024f556fcd5bf1288c6333016f576cfa5f539 (patch) | |
tree | 26e936c19c55aa2484d3ae6c4c23e9fde3ff0d2d /fs/cifs/transport.c | |
parent | a05885ce13bd5ec9602551e32dfb1a4f26bfa542 (diff) | |
download | linux-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/transport.c')
-rw-r--r-- | fs/cifs/transport.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 548cb376942e..8540f7c13eae 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -1049,7 +1049,10 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses) /* round robin */ index = (uint)atomic_inc_return(&ses->chan_seq); + + spin_lock(&ses->chan_lock); index %= ses->chan_count; + spin_unlock(&ses->chan_lock); return ses->chans[index].server; } |