Commit 8d856c72 authored by Chengguang Xu's avatar Chengguang Xu Committed by Linus Torvalds

net/9p: detect invalid options as much as possible

Currently when detecting invalid options in option parsing, some
options(e.g.  msize) just set errno and allow to continuously validate
other options so that it can detect invalid options as much as possible
and give proper error messages together.

This patch applies same rule to option 'trans' and 'version' when
detecting -EINVAL.

Link: http://lkml.kernel.org/r/1525340676-34072-1-git-send-email-cgxu519@gmx.comSigned-off-by: default avatarChengguang Xu <cgxu519@gmx.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c6137fe3
...@@ -198,8 +198,6 @@ static int parse_opts(char *opts, struct p9_client *clnt) ...@@ -198,8 +198,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
pr_info("Could not find request transport: %s\n", pr_info("Could not find request transport: %s\n",
s); s);
ret = -EINVAL; ret = -EINVAL;
kfree(s);
goto free_and_return;
} }
kfree(s); kfree(s);
break; break;
...@@ -214,13 +212,12 @@ static int parse_opts(char *opts, struct p9_client *clnt) ...@@ -214,13 +212,12 @@ static int parse_opts(char *opts, struct p9_client *clnt)
"problem allocating copy of version arg\n"); "problem allocating copy of version arg\n");
goto free_and_return; goto free_and_return;
} }
ret = get_protocol_version(s); r = get_protocol_version(s);
if (ret == -EINVAL) { if (r < 0)
kfree(s); ret = r;
goto free_and_return; else
} clnt->proto_version = r;
kfree(s); kfree(s);
clnt->proto_version = ret;
break; break;
default: default:
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment