]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-6.1/smb3-missing-lock-when-picking-channel.patch
Fixes for 6.1
[thirdparty/kernel/stable-queue.git] / queue-6.1 / smb3-missing-lock-when-picking-channel.patch
CommitLineData
008e49bb
SL
1From 48319c77f85c88042d8d22396f93ac58956be208 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Thu, 25 Apr 2024 11:30:16 -0500
4Subject: smb3: missing lock when picking channel
5
6From: Steve French <stfrench@microsoft.com>
7
8[ Upstream commit 8094a600245e9b28eb36a13036f202ad67c1f887 ]
9
10Coverity spotted a place where we should have been holding the
11channel lock when accessing the ses channel index.
12
13Addresses-Coverity: 1582039 ("Data race condition (MISSING_LOCK)")
14Cc: stable@vger.kernel.org
15Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
16Signed-off-by: Steve French <stfrench@microsoft.com>
17Signed-off-by: Sasha Levin <sashal@kernel.org>
18---
19 fs/smb/client/transport.c | 4 +++-
20 1 file changed, 3 insertions(+), 1 deletion(-)
21
22diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
23index da2bef3b7ac27..3fdafb9297f13 100644
24--- a/fs/smb/client/transport.c
25+++ b/fs/smb/client/transport.c
26@@ -1079,9 +1079,11 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses)
27 index = (uint)atomic_inc_return(&ses->chan_seq);
28 index %= ses->chan_count;
29 }
30+
31+ server = ses->chans[index].server;
32 spin_unlock(&ses->chan_lock);
33
34- return ses->chans[index].server;
35+ return server;
36 }
37
38 int
39--
402.43.0
41