aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-07-06 08:10:36 -0400
committerSteve French <sfrench@us.ibm.com>2011-07-06 16:03:05 -0400
commitb2a0fa152072f0085fa8d8eb0dbf9b3b0c5952fc (patch)
tree59e205c8c98301f1465d7ff1bad45b8f833456b2 /fs
parent677d8537d875832019fa989186f084ba47ecd93d (diff)
cifs: fix build_unc_path_to_root to account for a prefixpath
Regression introduced by commit f87d39d9513. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/connect.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 545e85465747..44376ce41e42 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2855,19 +2855,28 @@ cifs_cleanup_volume_info(struct smb_vol **pvolume_info)
2855/* build_path_to_root returns full path to root when 2855/* build_path_to_root returns full path to root when
2856 * we do not have an exiting connection (tcon) */ 2856 * we do not have an exiting connection (tcon) */
2857static char * 2857static char *
2858build_unc_path_to_root(const struct smb_vol *volume_info, 2858build_unc_path_to_root(const struct smb_vol *vol,
2859 const struct cifs_sb_info *cifs_sb) 2859 const struct cifs_sb_info *cifs_sb)
2860{ 2860{
2861 char *full_path; 2861 char *full_path, *pos;
2862 unsigned int pplen = vol->prepath ? strlen(vol->prepath) : 0;
2863 unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1);
2862 2864
2863 int unc_len = strnlen(volume_info->UNC, MAX_TREE_SIZE + 1); 2865 full_path = kmalloc(unc_len + pplen + 1, GFP_KERNEL);
2864 full_path = kmalloc(unc_len + 1, GFP_KERNEL);
2865 if (full_path == NULL) 2866 if (full_path == NULL)
2866 return ERR_PTR(-ENOMEM); 2867 return ERR_PTR(-ENOMEM);
2867 2868
2868 strncpy(full_path, volume_info->UNC, unc_len); 2869 strncpy(full_path, vol->UNC, unc_len);
2869 full_path[unc_len] = 0; /* add trailing null */ 2870 pos = full_path + unc_len;
2871
2872 if (pplen) {
2873 strncpy(pos, vol->prepath, pplen);
2874 pos += pplen;
2875 }
2876
2877 *pos = '\0'; /* add trailing null */
2870 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); 2878 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
2879 cFYI(1, "%s: full_path=%s", __func__, full_path);
2871 return full_path; 2880 return full_path;
2872} 2881}
2873 2882