summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLatchesar Ionkov <lucho@ionkov.net>2007-11-06 08:02:53 -0600
committerEric Van Hensbergen <ericvh@gmail.com>2007-11-06 08:02:53 -0600
commit8999e04f3b7930f0c6f091a541237de51d8dd372 (patch)
tree5e47b7b4024928e4e7f35ff584cfdd99d75a29a0
parentdda6b022f3222f09d3fb49f5dfabd31d33e0d10b (diff)
downloadlwn-8999e04f3b7930f0c6f091a541237de51d8dd372.tar.gz
lwn-8999e04f3b7930f0c6f091a541237de51d8dd372.zip
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: Latchesar Ionkov <lucho@ionkov.net> Acked-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r--fs/9p/v9fs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 756f7e9beb2e..fbb12dadba83 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -82,7 +82,7 @@ static match_table_t tokens = {
static void v9fs_parse_options(struct v9fs_session_info *v9ses)
{
- char *options = v9ses->options;
+ char *options;
substring_t args[MAX_OPT_ARGS];
char *p;
int option;
@@ -96,9 +96,10 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
v9ses->cache = 0;
v9ses->trans = v9fs_default_trans();
- if (!options)
+ if (!v9ses->options)
return;
+ options = kstrdup(v9ses->options, GFP_KERNEL);
while ((p = strsep(&options, ",")) != NULL) {
int token;
if (!*p)
@@ -169,6 +170,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
continue;
}
}
+ kfree(options);
}
/**