Commit 65d3a68a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  9p: add missing end-of-options record for trans_fd
  9p: return NULL when trans not found
  9p: use copy of the options value instead of original
  9p: fix memory leak in v9fs_get_sb
parents 2658770b 55762690
...@@ -82,7 +82,7 @@ static match_table_t tokens = { ...@@ -82,7 +82,7 @@ static match_table_t tokens = {
static void v9fs_parse_options(struct v9fs_session_info *v9ses) static void v9fs_parse_options(struct v9fs_session_info *v9ses)
{ {
char *options = v9ses->options; char *options;
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
char *p; char *p;
int option; int option;
...@@ -96,9 +96,10 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses) ...@@ -96,9 +96,10 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
v9ses->cache = 0; v9ses->cache = 0;
v9ses->trans = v9fs_default_trans(); v9ses->trans = v9fs_default_trans();
if (!options) if (!v9ses->options)
return; return;
options = kstrdup(v9ses->options, GFP_KERNEL);
while ((p = strsep(&options, ",")) != NULL) { while ((p = strsep(&options, ",")) != NULL) {
int token; int token;
if (!*p) if (!*p)
...@@ -169,6 +170,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses) ...@@ -169,6 +170,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
continue; continue;
} }
} }
kfree(options);
} }
/** /**
......
...@@ -119,6 +119,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -119,6 +119,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
P9_DPRINTK(P9_DEBUG_VFS, " \n"); P9_DPRINTK(P9_DEBUG_VFS, " \n");
st = NULL;
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
if (!v9ses) if (!v9ses)
return -ENOMEM; return -ENOMEM;
...@@ -164,10 +165,12 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, ...@@ -164,10 +165,12 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
root->d_inode->i_ino = v9fs_qid2ino(&st->qid); root->d_inode->i_ino = v9fs_qid2ino(&st->qid);
v9fs_stat2inode(st, root->d_inode, sb); v9fs_stat2inode(st, root->d_inode, sb);
v9fs_fid_add(root, fid); v9fs_fid_add(root, fid);
kfree(st);
return simple_set_mnt(mnt, sb); return simple_set_mnt(mnt, sb);
error: error:
kfree(st);
if (fid) if (fid)
p9_client_clunk(fid); p9_client_clunk(fid);
......
...@@ -76,9 +76,9 @@ struct p9_trans_module *v9fs_match_trans(const substring_t *name) ...@@ -76,9 +76,9 @@ struct p9_trans_module *v9fs_match_trans(const substring_t *name)
list_for_each(p, &v9fs_trans_list) { list_for_each(p, &v9fs_trans_list) {
t = list_entry(p, struct p9_trans_module, list); t = list_entry(p, struct p9_trans_module, list);
if (strncmp(t->name, name->from, name->to-name->from) == 0) if (strncmp(t->name, name->from, name->to-name->from) == 0)
break; return t;
} }
return t; return NULL;
} }
EXPORT_SYMBOL(v9fs_match_trans); EXPORT_SYMBOL(v9fs_match_trans);
......
...@@ -62,13 +62,14 @@ struct p9_trans_fd { ...@@ -62,13 +62,14 @@ struct p9_trans_fd {
enum { enum {
/* Options that take integer arguments */ /* Options that take integer arguments */
Opt_port, Opt_rfdno, Opt_wfdno, Opt_port, Opt_rfdno, Opt_wfdno, Opt_err,
}; };
static match_table_t tokens = { static match_table_t tokens = {
{Opt_port, "port=%u"}, {Opt_port, "port=%u"},
{Opt_rfdno, "rfdno=%u"}, {Opt_rfdno, "rfdno=%u"},
{Opt_wfdno, "wfdno=%u"}, {Opt_wfdno, "wfdno=%u"},
{Opt_err, NULL},
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment