aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/v9fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/v9fs.c')
-rw-r--r--fs/9p/v9fs.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index b85efa773949..b20af7465786 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -184,10 +184,20 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
184 v9ses->afid = option; 184 v9ses->afid = option;
185 break; 185 break;
186 case Opt_uname: 186 case Opt_uname:
187 match_strlcpy(v9ses->uname, &args[0], PATH_MAX); 187 kfree(v9ses->uname);
188 v9ses->uname = match_strdup(&args[0]);
189 if (!v9ses->uname) {
190 ret = -ENOMEM;
191 goto free_and_return;
192 }
188 break; 193 break;
189 case Opt_remotename: 194 case Opt_remotename:
190 match_strlcpy(v9ses->aname, &args[0], PATH_MAX); 195 kfree(v9ses->aname);
196 v9ses->aname = match_strdup(&args[0]);
197 if (!v9ses->aname) {
198 ret = -ENOMEM;
199 goto free_and_return;
200 }
191 break; 201 break;
192 case Opt_nodevmap: 202 case Opt_nodevmap:
193 v9ses->nodev = 1; 203 v9ses->nodev = 1;
@@ -287,21 +297,21 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
287 struct p9_fid *fid; 297 struct p9_fid *fid;
288 int rc; 298 int rc;
289 299
290 v9ses->uname = __getname(); 300 v9ses->uname = kstrdup(V9FS_DEFUSER, GFP_KERNEL);
291 if (!v9ses->uname) 301 if (!v9ses->uname)
292 return ERR_PTR(-ENOMEM); 302 return ERR_PTR(-ENOMEM);
293 303
294 v9ses->aname = __getname(); 304 v9ses->aname = kstrdup(V9FS_DEFANAME, GFP_KERNEL);
295 if (!v9ses->aname) { 305 if (!v9ses->aname) {
296 __putname(v9ses->uname); 306 kfree(v9ses->uname);
297 return ERR_PTR(-ENOMEM); 307 return ERR_PTR(-ENOMEM);
298 } 308 }
299 init_rwsem(&v9ses->rename_sem); 309 init_rwsem(&v9ses->rename_sem);
300 310
301 rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY); 311 rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY);
302 if (rc) { 312 if (rc) {
303 __putname(v9ses->aname); 313 kfree(v9ses->aname);
304 __putname(v9ses->uname); 314 kfree(v9ses->uname);
305 return ERR_PTR(rc); 315 return ERR_PTR(rc);
306 } 316 }
307 317
@@ -309,8 +319,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
309 list_add(&v9ses->slist, &v9fs_sessionlist); 319 list_add(&v9ses->slist, &v9fs_sessionlist);
310 spin_unlock(&v9fs_sessionlist_lock); 320 spin_unlock(&v9fs_sessionlist_lock);
311 321
312 strcpy(v9ses->uname, V9FS_DEFUSER);
313 strcpy(v9ses->aname, V9FS_DEFANAME);
314 v9ses->uid = ~0; 322 v9ses->uid = ~0;
315 v9ses->dfltuid = V9FS_DEFUID; 323 v9ses->dfltuid = V9FS_DEFUID;
316 v9ses->dfltgid = V9FS_DEFGID; 324 v9ses->dfltgid = V9FS_DEFGID;
@@ -412,8 +420,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
412 kfree(v9ses->cachetag); 420 kfree(v9ses->cachetag);
413 } 421 }
414#endif 422#endif
415 __putname(v9ses->uname); 423 kfree(v9ses->uname);
416 __putname(v9ses->aname); 424 kfree(v9ses->aname);
417 425
418 bdi_destroy(&v9ses->bdi); 426 bdi_destroy(&v9ses->bdi);
419 427