This is a note to let you know that I've just added the patch titled smb3: missing lock when picking channel to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: smb3-missing-lock-when-picking-channel.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 48319c77f85c88042d8d22396f93ac58956be208 Author: Steve French <stfrench@xxxxxxxxxxxxx> Date: Thu Apr 25 11:30:16 2024 -0500 smb3: missing lock when picking channel [ Upstream commit 8094a600245e9b28eb36a13036f202ad67c1f887 ] 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@xxxxxxxxxxxxxxx Reviewed-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index da2bef3b7ac27..3fdafb9297f13 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -1079,9 +1079,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