Commit 8378a51e authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French
Browse files

cifs: fix potential double free during failed mount

parent bf272460
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -838,7 +838,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
	      int flags, struct smb3_fs_context *old_ctx)
{
	int rc;
	struct super_block *sb;
	struct super_block *sb = NULL;
	struct cifs_sb_info *cifs_sb = NULL;
	struct cifs_mnt_data mnt_data;
	struct dentry *root;
@@ -934,10 +934,12 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
	return root;
out:
	if (cifs_sb) {
		if (!sb || IS_ERR(sb)) {  /* otherwise kill_sb will handle */
			kfree(cifs_sb->prepath);
			smb3_cleanup_fs_context(cifs_sb->ctx);
			kfree(cifs_sb);
		}
	}
	return root;
}