]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cifs: add NULL check for ses->tcon_ipc
authorAurelien Aptel <aaptel@suse.com>
Thu, 3 Dec 2020 18:46:08 +0000 (19:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Dec 2020 12:22:07 +0000 (13:22 +0100)
commit 59463eb88829f646aed13283fd84d02a475334fe upstream.

In some scenarios (DFS and BAD_NETWORK_NAME) set_root_set() can be
called with a NULL ses->tcon_ipc.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/connect.c

index cc524e31e4495b98914dcbe03a468ef39b32d47f..0e6773f82ef1bbbee33339b810524bbf50a7a132 100644 (file)
@@ -4768,7 +4768,8 @@ static void set_root_ses(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
        if (ses) {
                spin_lock(&cifs_tcp_ses_lock);
                ses->ses_count++;
-               ses->tcon_ipc->remap = cifs_remap(cifs_sb);
+               if (ses->tcon_ipc)
+                       ses->tcon_ipc->remap = cifs_remap(cifs_sb);
                spin_unlock(&cifs_tcp_ses_lock);
        }
        *root_ses = ses;