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 /net/9p/trans_rdma.c | |
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 'net/9p/trans_rdma.c')
-rw-r--r-- | net/9p/trans_rdma.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 65cb29db03f8..2c95a89c0f46 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c | |||
@@ -166,7 +166,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) | |||
166 | char *p; | 166 | char *p; |
167 | substring_t args[MAX_OPT_ARGS]; | 167 | substring_t args[MAX_OPT_ARGS]; |
168 | int option; | 168 | int option; |
169 | char *options; | 169 | char *options, *tmp_options; |
170 | int ret; | 170 | int ret; |
171 | 171 | ||
172 | opts->port = P9_PORT; | 172 | opts->port = P9_PORT; |
@@ -177,12 +177,13 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) | |||
177 | if (!params) | 177 | if (!params) |
178 | return 0; | 178 | return 0; |
179 | 179 | ||
180 | options = kstrdup(params, GFP_KERNEL); | 180 | tmp_options = kstrdup(params, GFP_KERNEL); |
181 | if (!options) { | 181 | if (!tmp_options) { |
182 | P9_DPRINTK(P9_DEBUG_ERROR, | 182 | P9_DPRINTK(P9_DEBUG_ERROR, |
183 | "failed to allocate copy of option string\n"); | 183 | "failed to allocate copy of option string\n"); |
184 | return -ENOMEM; | 184 | return -ENOMEM; |
185 | } | 185 | } |
186 | options = tmp_options; | ||
186 | 187 | ||
187 | while ((p = strsep(&options, ",")) != NULL) { | 188 | while ((p = strsep(&options, ",")) != NULL) { |
188 | int token; | 189 | int token; |
@@ -216,7 +217,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) | |||
216 | } | 217 | } |
217 | /* RQ must be at least as large as the SQ */ | 218 | /* RQ must be at least as large as the SQ */ |
218 | opts->rq_depth = max(opts->rq_depth, opts->sq_depth); | 219 | opts->rq_depth = max(opts->rq_depth, opts->sq_depth); |
219 | kfree(options); | 220 | kfree(tmp_options); |
220 | return 0; | 221 | return 0; |
221 | } | 222 | } |
222 | 223 | ||