cifs: missing null pointer check in cifs_mount
authorSteve French <stfrench@microsoft.com>
Thu, 24 Jun 2021 00:32:24 +0000 (19:32 -0500)
committerSteve French <stfrench@microsoft.com>
Thu, 24 Jun 2021 00:32:24 +0000 (19:32 -0500)
We weren't checking if tcon is null before setting dfs path,
although we check for null tcon in an earlier assignment statement.

Addresses-Coverity: 1476411 ("Dereference after null check")
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c

index 8d95607..c807937 100644 (file)
@@ -3451,7 +3451,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
                        rc = -ELOOP;
        } while (rc == -EREMOTE);
 
-       if (rc)
+       if (rc || !tcon)
                goto error;
 
        kfree(ref_path);