]> git.itanic.dy.fi Git - linux-stable/commitdiff
smb: client: fix potential UAF in cifs_signal_cifsd_for_reconnect()
authorPaulo Alcantara <pc@manguebit.com>
Tue, 2 Apr 2024 19:34:04 +0000 (16:34 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:38:21 +0000 (16:38 +0200)
commit e0e50401cc3921c9eaf1b0e667db174519ea939f upstream.

Skip sessions that are being teared down (status == SES_EXITING) to
avoid UAF.

Cc: stable@vger.kernel.org
Signed-off-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/connect.c

index 087859619a9a950107be0a96f85f3d1121e24a91..7516c7d4558d86ea839843cfdc904ad485515adf 100644 (file)
@@ -178,6 +178,8 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
 
        spin_lock(&cifs_tcp_ses_lock);
        list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
+               if (cifs_ses_exiting(ses))
+                       continue;
                spin_lock(&ses->chan_lock);
                for (i = 0; i < ses->chan_count; i++) {
                        if (!ses->chans[i].server)