diff mbox series

cifs: add NULL check for ses->tcon_ipc

Message ID 20201203184608.8384-1-aaptel@suse.com
State New
Headers show
Series cifs: add NULL check for ses->tcon_ipc | expand

Commit Message

Aurélien Aptel Dec. 3, 2020, 6:46 p.m. UTC
From: Aurelien Aptel <aaptel@suse.com>

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>
---
 fs/cifs/connect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paulo Alcantara Dec. 3, 2020, 6:54 p.m. UTC | #1
Aurélien Aptel <aaptel@suse.com> writes:

> From: Aurelien Aptel <aaptel@suse.com>
>
> 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>
> ---
>  fs/cifs/connect.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
diff mbox series

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 28c1459fb0fc0..44f9cce570995 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4546,7 +4546,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;