From patchwork Mon Feb 8 22:41:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Van Hensbergen X-Patchwork-Id: 77866 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o18MfGno022982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 8 Feb 2010 22:41:52 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NecI2-0007Fv-3h; Mon, 08 Feb 2010 22:41:10 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NecI1-0007Fj-1s for v9fs-developer@lists.sourceforge.net; Mon, 08 Feb 2010 22:41:09 +0000 Received-SPF: neutral (sfi-mx-2.v28.ch3.sourceforge.com: 32.97.110.150 is neither permitted nor denied by domain of gmail.com) client-ip=32.97.110.150; envelope-from=ericvh@gmail.com; helo=e32.co.us.ibm.com; Received: from e32.co.us.ibm.com ([32.97.110.150]) by sfi-mx-2.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1NecI0-0001xK-6T for v9fs-developer@lists.sourceforge.net; Mon, 08 Feb 2010 22:41:08 +0000 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e32.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o18MYl1u019078 for ; Mon, 8 Feb 2010 15:34:47 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o18MetM0046680 for ; Mon, 8 Feb 2010 15:40:56 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o18MeqAk023858 for ; Mon, 8 Feb 2010 15:40:52 -0700 Received: from localhost.localdomain (arly004.austin.ibm.com [9.3.45.4]) by d03av02.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o18Mepuv023747; Mon, 8 Feb 2010 15:40:51 -0700 From: ericvh@gmail.com To: v9fs-developer@lists.sourceforge.net Date: Mon, 8 Feb 2010 16:41:18 -0600 Message-Id: <1265668878-14116-1-git-send-email-ericvh@gmail.com> X-Mailer: git-send-email 1.6.3.3 X-Spam-Score: -2.8 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -4.0 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [32.97.110.150 listed in list.dnswl.org] 1.2 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) X-Headers-End: 1NecI0-0001xK-6T Cc: Eric Van Hensbergen Subject: [V9fs-developer] [PATCH] 9p: make options mismatch fatal X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 08 Feb 2010 22:41:52 +0000 (UTC) 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