diff options
author | Eric Van Hensbergen <ericvh@gmail.com> | 2010-02-08 23:23:23 +0100 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-02-08 23:23:23 +0100 |
commit | d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6 (patch) | |
tree | b52f301bd5811b9b813b6d244b555edbab38299a /net/9p/client.c | |
parent | 9p: Include fsync support for 9p client (diff) | |
download | linux-d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6.tar.xz linux-d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6.zip |
9p: fix option parsing
Options pointer is being moved before calling kfree() which seems
to cause problems. This uses a separate pointer to track and free
original allocation.
Signed-off-by: Venkateswararao Jujjuri <jvrao@us.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>w
Diffstat (limited to 'net/9p/client.c')
-rw-r--r-- | net/9p/client.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index a2e2d61b903b..cbe066966b3c 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -69,7 +69,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); static int parse_opts(char *opts, struct p9_client *clnt) { - char *options; + char *options, *tmp_options; char *p; substring_t args[MAX_OPT_ARGS]; int option; @@ -81,12 +81,13 @@ static int parse_opts(char *opts, struct p9_client *clnt) if (!opts) return 0; - options = kstrdup(opts, GFP_KERNEL); - if (!options) { + tmp_options = kstrdup(opts, GFP_KERNEL); + if (!tmp_options) { P9_DPRINTK(P9_DEBUG_ERROR, "failed to allocate copy of option string\n"); return -ENOMEM; } + options = tmp_options; while ((p = strsep(&options, ",")) != NULL) { int token; @@ -125,7 +126,7 @@ static int parse_opts(char *opts, struct p9_client *clnt) } free_and_return: - kfree(options); + kfree(tmp_options); return ret; } |