From: Steve French Date: Thu, 25 Apr 2024 16:30:16 +0000 (-0500) Subject: smb3: missing lock when picking channel X-Git-Tag: v6.9-rc6~6^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8094a600245e9b28eb36a13036f202ad67c1f887;p=thirdparty%2Flinux.git 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 Signed-off-by: Steve French --- diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index 994d701934329..e1a79e031b28c 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