aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2024-04-25 11:30:16 -0500
committerSteve French <stfrench@microsoft.com>2024-04-25 12:47:23 -0500
commit8094a600245e9b28eb36a13036f202ad67c1f887 (patch)
tree3c6267f9399cfb2287a83720f3025c2992473499
parent9a1f1d04f63c59550a5364858b46eeffdf03e8d6 (diff)
downloadlinux-8094a600245e9b28eb36a13036f202ad67c1f887.tar.gz
smb3: missing lock when picking channel
Coverity spotted a place where we should have been holding the channel lock when accessing the ses channel index. Addresses-Coverity: 1582039 ("Data race condition (MISSING_LOCK)") Cc: stable@vger.kernel.org Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/transport.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index 994d7019343297..e1a79e031b28cc 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -1057,9 +1057,11 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
index = (uint)atomic_inc_return(&ses->chan_seq);
index %= ses->chan_count;
}
+
+ server = ses->chans[index].server;
spin_unlock(&ses->chan_lock);
- return ses->chans[index].server;
+ return server;
}
int