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
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index cf62b05..6848788 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -84,7 +84,7 @@
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 @@
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 @@
continue;
}
}
- kfree(options);
+
+ kfree(tmp_options);
return ret;
fail_option_alloc: