diff options
-rw-r--r-- | fs/cifs/cifsfs.c | 20 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 10 |
3 files changed, 18 insertions, 14 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 6bbec5e784cd..cc9cdab52dab 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -686,26 +686,22 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
686 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); | 686 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); |
687 | if (cifs_sb->mountdata == NULL) { | 687 | if (cifs_sb->mountdata == NULL) { |
688 | root = ERR_PTR(-ENOMEM); | 688 | root = ERR_PTR(-ENOMEM); |
689 | goto out_cifs_sb; | 689 | goto out_free; |
690 | } | 690 | } |
691 | 691 | ||
692 | if (volume_info->prepath) { | 692 | rc = cifs_setup_cifs_sb(volume_info, cifs_sb); |
693 | cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); | 693 | if (rc) { |
694 | if (cifs_sb->prepath == NULL) { | 694 | root = ERR_PTR(rc); |
695 | root = ERR_PTR(-ENOMEM); | 695 | goto out_free; |
696 | goto out_cifs_sb; | ||
697 | } | ||
698 | } | 696 | } |
699 | 697 | ||
700 | cifs_setup_cifs_sb(volume_info, cifs_sb); | ||
701 | |||
702 | rc = cifs_mount(cifs_sb, volume_info); | 698 | rc = cifs_mount(cifs_sb, volume_info); |
703 | if (rc) { | 699 | if (rc) { |
704 | if (!(flags & MS_SILENT)) | 700 | if (!(flags & MS_SILENT)) |
705 | cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", | 701 | cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", |
706 | rc); | 702 | rc); |
707 | root = ERR_PTR(rc); | 703 | root = ERR_PTR(rc); |
708 | goto out_mountdata; | 704 | goto out_free; |
709 | } | 705 | } |
710 | 706 | ||
711 | mnt_data.vol = volume_info; | 707 | mnt_data.vol = volume_info; |
@@ -752,9 +748,9 @@ out: | |||
752 | cifs_cleanup_volume_info(volume_info); | 748 | cifs_cleanup_volume_info(volume_info); |
753 | return root; | 749 | return root; |
754 | 750 | ||
755 | out_mountdata: | 751 | out_free: |
752 | kfree(cifs_sb->prepath); | ||
756 | kfree(cifs_sb->mountdata); | 753 | kfree(cifs_sb->mountdata); |
757 | out_cifs_sb: | ||
758 | kfree(cifs_sb); | 754 | kfree(cifs_sb); |
759 | out_nls: | 755 | out_nls: |
760 | unload_nls(volume_info->local_nls); | 756 | unload_nls(volume_info->local_nls); |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1243bd326591..95dab43646f0 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -184,7 +184,7 @@ extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, | |||
184 | unsigned int to_read); | 184 | unsigned int to_read); |
185 | extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, | 185 | extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, |
186 | struct page *page, unsigned int to_read); | 186 | struct page *page, unsigned int to_read); |
187 | extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 187 | extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
188 | struct cifs_sb_info *cifs_sb); | 188 | struct cifs_sb_info *cifs_sb); |
189 | extern int cifs_match_super(struct super_block *, void *); | 189 | extern int cifs_match_super(struct super_block *, void *); |
190 | extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); | 190 | extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 7ae03283bd61..4546926680d4 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -3222,7 +3222,7 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, | |||
3222 | } | 3222 | } |
3223 | } | 3223 | } |
3224 | 3224 | ||
3225 | void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 3225 | int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
3226 | struct cifs_sb_info *cifs_sb) | 3226 | struct cifs_sb_info *cifs_sb) |
3227 | { | 3227 | { |
3228 | INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); | 3228 | INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); |
@@ -3316,6 +3316,14 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
3316 | 3316 | ||
3317 | if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) | 3317 | if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) |
3318 | cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); | 3318 | cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); |
3319 | |||
3320 | if (pvolume_info->prepath) { | ||
3321 | cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); | ||
3322 | if (cifs_sb->prepath == NULL) | ||
3323 | return -ENOMEM; | ||
3324 | } | ||
3325 | |||
3326 | return 0; | ||
3319 | } | 3327 | } |
3320 | 3328 | ||
3321 | static void | 3329 | static void |