提交 8999e04f 编写于 作者: L Latchesar Ionkov 提交者: Eric Van Hensbergen

9p: use copy of the options value instead of original

v9fs_parse_options function uses strsep which modifies the value of the
v9ses->options field. That modified value is later passed to the function
that creates the transport potentially making the transport creation
function to fail.

This patch creates a copy of v9ses->option field that v9fs_parse_options
function uses instead of the original value.
Signed-off-by: NLatchesar Ionkov <lucho@ionkov.net>
Acked-by: NEric Van Hensbergen <ericvh@gmail.com>
上级 dda6b022
...@@ -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);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册