cifs: Fix an error pointer dereference in cifs_mount()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 5 Aug 2020 09:52:07 +0000 (12:52 +0300)
committerSteve French <stfrench@microsoft.com>
Fri, 7 Aug 2020 03:06:10 +0000 (22:06 -0500)
The error handling calls kfree(full_path) so we can't let it be a NULL
pointer.  There used to be a NULL assignment here but we accidentally
deleted it.  Add it back.

Fixes: 7efd08158261 ("cifs: document and cleanup dfs mount")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
fs/cifs/connect.c

index 7e3e5e2..2fe6b1a 100644 (file)
@@ -4886,6 +4886,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol)
                full_path = build_unc_path_to_root(vol, cifs_sb, !!count);
                if (IS_ERR(full_path)) {
                        rc = PTR_ERR(full_path);
+                       full_path = NULL;
                        break;
                }
                /* Chase referral */