net/9p: fail when user specifies a transport which we can't find
authorEric Van Hensbergen <ericvh@gmail.com>
Sat, 16 Jan 2010 01:01:10 +0000 (19:01 -0600)
committerEric Van Hensbergen <ericvh@gmail.com>
Mon, 8 Feb 2010 20:13:30 +0000 (14:13 -0600)
If the user specifies a transport and we can't find it, we failed back
to the default trainsport silently.  This patch will make the code
complain more loudly and return an error code.

Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
net/9p/client.c

index 8af95b2dddd62eb4baa6205c776681bf09b91a64..90a2eb926d19adabb5648e72f93e38177aedc143 100644 (file)
@@ -108,6 +108,13 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                        break;
                case Opt_trans:
                        clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
+                       if(clnt->trans_mod == NULL) {
+                               P9_DPRINTK(P9_DEBUG_ERROR,
+                                  "Could not find request transport: %s\n",
+                                  (char *) &args[0]);
+                               ret = -EINVAL;
+                               goto free_and_return;
+                       }
                        break;
                case Opt_legacy:
                        clnt->dotu = 0;
@@ -117,6 +124,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                }
        }
 
+free_and_return:
        kfree(options);
        return ret;
 }