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.
Unified · Split
| @@ -65,6 +65,8 @@ static int ip_connect(struct TCP_Server_Info *server); · 64 unmodified lines | ||
| 65 | 65 | static int generic_ip_connect(struct TCP_Server_Info *server); |
| 66 | 66 | static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink); |
| 67 | 67 | 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); | |
| 68 | 70 | |
| 69 | 71 | /* |
| 70 | 72 | * cifs tcp session reconnection |
| @@ -2830,12 +2832,9 @@ is_path_accessible(int xid, struct cifs_tcon *tcon, · 2759 unmodified lines | ||
| 2830 | 2832 | return rc; |
| 2831 | 2833 | } |
| 2832 | 2834 | |
| 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) | |
| 2835 | 2837 | { |
| 2836 | − if (!volume_info) | |
| 2837 | − return; | |
| 2838 | − | |
| 2839 | 2838 | kfree(volume_info->username); |
| 2840 | 2839 | kzfree(volume_info->password); |
| 2841 | 2840 | kfree(volume_info->UNC); |
| @@ -2843,10 +2842,18 @@ cifs_cleanup_volume_info(struct smb_vol *volume_info) · 1 unmodified line | ||
| 2843 | 2842 | kfree(volume_info->domainname); |
| 2844 | 2843 | kfree(volume_info->iocharset); |
| 2845 | 2844 | 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); | |
| 2846 | 2853 | kfree(volume_info); |
| 2847 | − return; | |
| 2848 | 2854 | } |
| 2849 | 2855 | |
| 2856 | + | |
| 2850 | 2857 | #ifdef CONFIG_CIFS_DFS_UPCALL |
| 2851 | 2858 | /* build_path_to_root returns full path to root when |
| 2852 | 2859 | * we do not have an exiting connection (tcon) */ |
| @@ -2915,15 +2922,18 @@ expand_dfs_referral(int xid, struct cifs_ses *pSesInfo, · 62 unmodified lines | ||
| 2915 | 2922 | &fake_devname); |
| 2916 | 2923 | |
| 2917 | 2924 | free_dfs_info_array(referrals, num_referrals); |
| 2918 | − kfree(fake_devname); | |
| 2919 | − | |
| 2920 | − if (cifs_sb->mountdata != NULL) | |
| 2921 | − kfree(cifs_sb->mountdata); | |
| 2922 | 2925 | |
| 2923 | 2926 | if (IS_ERR(mdata)) { |
| 2924 | 2927 | rc = PTR_ERR(mdata); |
| 2925 | 2928 | 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); | |
| 2926 | 2934 | } |
| 2935 | + kfree(fake_devname); | |
| 2936 | + kfree(cifs_sb->mountdata); | |
| 2927 | 2937 | cifs_sb->mountdata = mdata; |
| 2928 | 2938 | } |
| 2929 | 2939 | kfree(full_path); |