diff options
-rw-r--r-- | fs/cifs/cifsfs.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 0f6a54f14eff..bb39afcc6f38 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -129,24 +129,19 @@ cifs_read_super(struct super_block *sb, void *data, | |||
129 | cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages; | 129 | cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages; |
130 | 130 | ||
131 | #ifdef CONFIG_CIFS_DFS_UPCALL | 131 | #ifdef CONFIG_CIFS_DFS_UPCALL |
132 | /* copy mount params to sb for use in submounts */ | 132 | /* |
133 | /* BB: should we move this after the mount so we | 133 | * Copy mount params to sb for use in submounts. Better to do |
134 | * do not have to do the copy on failed mounts? | 134 | * the copy here and deal with the error before cleanup gets |
135 | * BB: May be it is better to do simple copy before | 135 | * complicated post-mount. |
136 | * complex operation (mount), and in case of fail | 136 | */ |
137 | * just exit instead of doing mount and attempting | ||
138 | * undo it if this copy fails?*/ | ||
139 | if (data) { | 137 | if (data) { |
140 | int len = strlen(data); | 138 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); |
141 | cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); | ||
142 | if (cifs_sb->mountdata == NULL) { | 139 | if (cifs_sb->mountdata == NULL) { |
143 | bdi_destroy(&cifs_sb->bdi); | 140 | bdi_destroy(&cifs_sb->bdi); |
144 | kfree(sb->s_fs_info); | 141 | kfree(sb->s_fs_info); |
145 | sb->s_fs_info = NULL; | 142 | sb->s_fs_info = NULL; |
146 | return -ENOMEM; | 143 | return -ENOMEM; |
147 | } | 144 | } |
148 | strncpy(cifs_sb->mountdata, data, len + 1); | ||
149 | cifs_sb->mountdata[len] = '\0'; | ||
150 | } | 145 | } |
151 | #endif | 146 | #endif |
152 | 147 | ||