diff mbox

[V9fs-developer] 9p: make options mismatch fatal

Message ID 1265668878-14116-1-git-send-email-ericvh@gmail.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Eric Van Hensbergen Feb. 8, 2010, 10:41 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 6848788..d529da6 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -113,12 +113,11 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 			continue;
 		token = match_token(p, tokens, args);
 		if (token < Opt_uname) {
-			int r = match_int(&args[0], &option);
-			if (r < 0) {
+			ret = match_int(&args[0], &option);
+			if (ret < 0) {
 				P9_DPRINTK(P9_DEBUG_ERROR,
 					"integer field, but no integer?\n");
-				ret = r;
-				continue;
+				goto free_and_return;
 			}
 		}
 		switch (token) {
@@ -196,6 +195,7 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 		}
 	}
 
+free_and_return:
 	kfree(tmp_options);
 	return ret;
 
diff --git a/net/9p/client.c b/net/9p/client.c
index cbe0669..bf26505 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -95,12 +95,13 @@  static int parse_opts(char *opts, struct p9_client *clnt)
 			continue;
 		token = match_token(p, tokens, args);
 		if (token < Opt_trans) {
-			int r = match_int(&args[0], &option);
-			if (r < 0) {
+			ret = match_int(&args[0], &option);
+			if (ret < 0) {
 				P9_DPRINTK(P9_DEBUG_ERROR,
 					"integer field, but no integer?\n");
-				ret = r;
-				continue;
+				if (clnt->trans_mod)
+					v9fs_put_trans(clnt->trans_mod);
+				goto free_and_return;
 			}
 		}
 		switch (token) {
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 31d0b05..6b22703 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -715,7 +715,7 @@  static int parse_opts(char *params, struct p9_fd_opts *opts)
 	substring_t args[MAX_OPT_ARGS];
 	int option;
 	char *options, *tmp_options;
-	int ret;
+	int ret = 0;
 
 	opts->port = P9_PORT;
 	opts->rfd = ~0;
@@ -734,17 +734,15 @@  static int parse_opts(char *params, struct p9_fd_opts *opts)
 
 	while ((p = strsep(&options, ",")) != NULL) {
 		int token;
-		int r;
 		if (!*p)
 			continue;
 		token = match_token(p, tokens, args);
 		if (token != Opt_err) {
-			r = match_int(&args[0], &option);
-			if (r < 0) {
+			ret = match_int(&args[0], &option);
+			if (ret < 0) {
 				P9_DPRINTK(P9_DEBUG_ERROR,
 				"integer field, but no integer?\n");
-				ret = r;
-				continue;
+				goto free_and_return;
 			}
 		}
 		switch (token) {
@@ -762,8 +760,9 @@  static int parse_opts(char *params, struct p9_fd_opts *opts)
 		}
 	}
 
+free_and_return:
 	kfree(tmp_options);
-	return 0;
+	return ret;
 }
 
 static int p9_fd_open(struct p9_client *client, int rfd, int wfd)
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 2c95a89..992a798 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -187,16 +187,14 @@  static int parse_opts(char *params, struct p9_rdma_opts *opts)
 
 	while ((p = strsep(&options, ",")) != NULL) {
 		int token;
-		int r;
 		if (!*p)
 			continue;
 		token = match_token(p, tokens, args);
-		r = match_int(&args[0], &option);
-		if (r < 0) {
+		ret = match_int(&args[0], &option);
+		if (ret < 0) {
 			P9_DPRINTK(P9_DEBUG_ERROR,
 				   "integer field, but no integer?\n");
-			ret = r;
-			continue;
+			goto free_and_return;
 		}
 		switch (token) {
 		case Opt_port:
@@ -217,8 +215,9 @@  static int parse_opts(char *params, struct p9_rdma_opts *opts)
 	}
 	/* RQ must be at least as large as the SQ */
 	opts->rq_depth = max(opts->rq_depth, opts->sq_depth);
+free_and_return:
 	kfree(tmp_options);
-	return 0;
+	return ret;
 }
 
 static int