summaryrefslogtreecommitdiffstats
path: root/fs/smb
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2024-04-25 18:30:16 +0200
committerSteve French <stfrench@microsoft.com>2024-04-25 19:47:23 +0200
commit8094a600245e9b28eb36a13036f202ad67c1f887 (patch)
tree3c6267f9399cfb2287a83720f3025c2992473499 /fs/smb
parentsmb: client: Fix struct_group() usage in __packed structs (diff)
downloadlinux-8094a600245e9b28eb36a13036f202ad67c1f887.tar.xz
linux-8094a600245e9b28eb36a13036f202ad67c1f887.zip
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>
Diffstat (limited to 'fs/smb')
-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 994d70193432..e1a79e031b28 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