9p: VFS switches for 9p2000.L: protocol and client changes
[safe/jmp/linux-2.6] / net / 9p / trans_fd.c
index be1cb90..98ce9bc 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/idr.h>
 #include <linux/file.h>
 #include <linux/parser.h>
+#include <linux/slab.h>
 #include <net/9p/9p.h>
 #include <net/9p/client.h>
 #include <net/9p/transport.h>
@@ -714,7 +715,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
        char *p;
        substring_t args[MAX_OPT_ARGS];
        int option;
-       char *options;
+       char *options, *tmp_options;
        int ret;
 
        opts->port = P9_PORT;
@@ -724,12 +725,13 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
        if (!params)
                return 0;
 
-       options = kstrdup(params, GFP_KERNEL);
-       if (!options) {
+       tmp_options = kstrdup(params, 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;
@@ -760,7 +762,8 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
                        continue;
                }
        }
-       kfree(options);
+
+       kfree(tmp_options);
        return 0;
 }