diff options
author | Eric Van Hensbergen <ericvh@gmail.com> | 2010-02-08 16:23:23 -0600 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-02-08 16:23:23 -0600 |
commit | d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6 (patch) | |
tree | b52f301bd5811b9b813b6d244b555edbab38299a /fs | |
parent | 7a4439c406c21b1e900ed497cec1a79d05b38c07 (diff) | |
download | linux-stable-d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6.tar.gz linux-stable-d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6.tar.bz2 linux-stable-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 'fs')
-rw-r--r-- | fs/9p/v9fs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index cf62b05e296a..6848788a13db 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -84,7 +84,7 @@ static const match_table_t tokens = { static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) { - char *options; + char *options, *tmp_options; substring_t args[MAX_OPT_ARGS]; char *p; int option = 0; @@ -102,9 +102,10 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) if (!opts) return 0; - options = kstrdup(opts, GFP_KERNEL); - if (!options) + tmp_options = kstrdup(opts, GFP_KERNEL); + if (!tmp_options) goto fail_option_alloc; + options = tmp_options; while ((p = strsep(&options, ",")) != NULL) { int token; @@ -194,7 +195,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) continue; } } - kfree(options); + + kfree(tmp_options); return ret; fail_option_alloc: |