History

cifs: fix expand_dfs_referral

Regression introduced in commit 724d9f1cfba. Prior to that, expand_dfs_referral would regenerate the mount data string and then call cifs_parse_mount_options to re-parse it (klunky, but it worked). The above commit moved cifs_parse_mount_options out of cifs_mount, so the re-parsing of the new mount options no longer occurred. Fix it by making expand_dfs_referral re-parse the mount options.

Jeff Layton committed 15 years ago

Commit b9bce2e1 parent 20547491 file · +20 −10Browse files

Unified · Split

fs/cifs/connect.c+20−10
@@ -65,6 +65,8 @@ static int ip_connect(struct TCP_Server_Info *server); · 64 unmodified lines
6565 static int generic_ip_connect(struct TCP_Server_Info *server);
6666 static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink);
6767 static void cifs_prune_tlinks(struct work_struct *work);
68+static int cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
69+ const char *devname);
6870
6971 /*
7072 * cifs tcp session reconnection
@@ -2830,12 +2832,9 @@ is_path_accessible(int xid, struct cifs_tcon *tcon, · 2759 unmodified lines
28302832 return rc;
28312833 }
28322834
2833−void
2834−cifs_cleanup_volume_info(struct smb_vol *volume_info)
2835+static void
2836+cleanup_volume_info_contents(struct smb_vol *volume_info)
28352837 {
2836− if (!volume_info)
2837− return;
2838−
28392838 kfree(volume_info->username);
28402839 kzfree(volume_info->password);
28412840 kfree(volume_info->UNC);
@@ -2843,10 +2842,18 @@ cifs_cleanup_volume_info(struct smb_vol *volume_info) · 1 unmodified line
28432842 kfree(volume_info->domainname);
28442843 kfree(volume_info->iocharset);
28452844 kfree(volume_info->prepath);
2845+}
2846+
2847+void
2848+cifs_cleanup_volume_info(struct smb_vol *volume_info)
2849+{
2850+ if (!volume_info)
2851+ return;
2852+ cleanup_volume_info_contents(volume_info);
28462853 kfree(volume_info);
2847− return;
28482854 }
28492855
2856+
28502857 #ifdef CONFIG_CIFS_DFS_UPCALL
28512858 /* build_path_to_root returns full path to root when
28522859 * we do not have an exiting connection (tcon) */
@@ -2915,15 +2922,18 @@ expand_dfs_referral(int xid, struct cifs_ses *pSesInfo, · 62 unmodified lines
29152922 &fake_devname);
29162923
29172924 free_dfs_info_array(referrals, num_referrals);
2918− kfree(fake_devname);
2919−
2920− if (cifs_sb->mountdata != NULL)
2921− kfree(cifs_sb->mountdata);
29222925
29232926 if (IS_ERR(mdata)) {
29242927 rc = PTR_ERR(mdata);
29252928 mdata = NULL;
2929+ } else {
2930+ cleanup_volume_info_contents(volume_info);
2931+ memset(volume_info, '\0', sizeof(*volume_info));
2932+ rc = cifs_setup_volume_info(volume_info, mdata,
2933+ fake_devname);
29262934 }
2935+ kfree(fake_devname);
2936+ kfree(cifs_sb->mountdata);
29272937 cifs_sb->mountdata = mdata;
29282938 }
29292939 kfree(full_path);