diff options
author | Eric Van Hensbergen <ericvh@gmail.com> | 2010-02-08 17:23:23 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-02-08 17:23:23 -0500 |
commit | d8c8a9e36560e9ff4c99279d64ce5dd0e1a33fa6 (patch) | |
tree | b52f301bd5811b9b813b6d244b555edbab38299a /fs | |
parent | 7a4439c406c21b1e900ed497cec1a79d05b38c07 (diff) |
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 cf62b05e296..6848788a13d 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -84,7 +84,7 @@ static const match_table_t tokens = { | |||
84 | 84 | ||
85 | static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | 85 | static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) |
86 | { | 86 | { |
87 | char *options; | 87 | char *options, *tmp_options; |
88 | substring_t args[MAX_OPT_ARGS]; | 88 | substring_t args[MAX_OPT_ARGS]; |
89 | char *p; | 89 | char *p; |
90 | int option = 0; | 90 | int option = 0; |
@@ -102,9 +102,10 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
102 | if (!opts) | 102 | if (!opts) |
103 | return 0; | 103 | return 0; |
104 | 104 | ||
105 | options = kstrdup(opts, GFP_KERNEL); | 105 | tmp_options = kstrdup(opts, GFP_KERNEL); |
106 | if (!options) | 106 | if (!tmp_options) |
107 | goto fail_option_alloc; | 107 | goto fail_option_alloc; |
108 | options = tmp_options; | ||
108 | 109 | ||
109 | while ((p = strsep(&options, ",")) != NULL) { | 110 | while ((p = strsep(&options, ",")) != NULL) { |
110 | int token; | 111 | int token; |
@@ -194,7 +195,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
194 | continue; | 195 | continue; |
195 | } | 196 | } |
196 | } | 197 | } |
197 | kfree(options); | 198 | |
199 | kfree(tmp_options); | ||
198 | return ret; | 200 | return ret; |
199 | 201 | ||
200 | fail_option_alloc: | 202 | fail_option_alloc: |