From: Steve French Date: Thu, 25 Apr 2024 16:30:16 +0000 (-0500) Subject: smb3: missing lock when picking channel X-Git-Tag: v6.10-rc5-pxa1908~494^2~1 X-Git-Url: https://git.dujemihanovic.xyz/?a=commitdiff_plain;h=8094a600245e9b28eb36a13036f202ad67c1f887;p=linux.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 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