]> www.infradead.org Git - users/jedix/linux-maple.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)
committerSteve French <stfrench@microsoft.com>
Fri, 7 Jun 2024 06:05:07 +0000 (01:05 -0500)
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>
fs/smb/client/smb2transport.c

index 02135a6053051ee6848f8df90be30fc2c805af6d..1476c445cadcf0f9238fd9e6545ec402e212fd4b 100644 (file)
@@ -216,8 +216,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);