]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
smb: client: protect tc_count increment in smb2_find_smb_sess_tcon_unlocked()
authorHenrique Carvalho <henrique.carvalho@suse.com>
Thu, 14 May 2026 23:18:25 +0000 (20:18 -0300)
committerSteve French <stfrench@microsoft.com>
Tue, 19 May 2026 15:35:12 +0000 (10:35 -0500)
Commit 96c4af418586 ("cifs: Fix locking usage for tcon fields")
refactored cifs code to change cifs_tcp_ses_lock for tc_lock around
tc_count changes.

There was missing lock around tc_count increment inside
smb2_find_smb_sess_tcon_unlocked().

Cc: stable@vger.kernel.org
Fixes: 96c4af418586 ("cifs: Fix locking usage for tcon fields")
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2transport.c

index e8eeff9e50d67f7e92c3282237ed44ef9df15378..1143ee52470a75d702e58a44ce4faa5309da358e 100644 (file)
@@ -169,7 +169,9 @@ smb2_find_smb_sess_tcon_unlocked(struct cifs_ses *ses, __u32  tid)
        list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
                if (tcon->tid != tid)
                        continue;
+               spin_lock(&tcon->tc_lock);
                ++tcon->tc_count;
+               spin_unlock(&tcon->tc_lock);
                trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
                                    netfs_trace_tcon_ref_get_find_sess_tcon);
                return tcon;