]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: client: fix deadlock in smb2_find_smb_tcon()
authorEnzo Matsumiya <ematsumiya@suse.de>
Thu, 6 Jun 2024 16:13:13 +0000 (13:13 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:41:42 +0000 (13:41 +0200)
commit 02c418774f76a0a36a6195c9dbf8971eb4130a15 upstream.

Unlock cifs_tcp_ses_lock before calling cifs_put_smb_ses() to avoid such
deadlock.

Cc: stable@vger.kernel.org
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/client/smb2transport.c

index 69dbd08fd441954afc4f4b05cd1baf9739ede9a9..763cf946e84910e0c3b1d7144c34833dd017389e 100644 (file)
@@ -213,8 +213,8 @@ smb2_find_smb_tcon(struct TCP_Server_Info *server, __u64 ses_id, __u32  tid)
        }
        tcon = smb2_find_smb_sess_tcon_unlocked(ses, tid);
        if (!tcon) {
-               cifs_put_smb_ses(ses);
                spin_unlock(&cifs_tcp_ses_lock);
+               cifs_put_smb_ses(ses);
                return NULL;
        }
        spin_unlock(&cifs_tcp_ses_lock);