summaryrefslogtreecommitdiffstats
path: root/net/9p/client.c
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2018-06-07 17:05:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 17:34:34 -0700
commit8d856c72b42d585fb17a8aa18454e03a0cf9b2b8 (patch)
treeac1346d6c3165b36b801e5c293766bf0ed712cc2 /net/9p/client.c
parentc6137fe36d2ac160d919bf97bc3dfd6494b0b471 (diff)
downloadlinux-8d856c72b42d585fb17a8aa18454e03a0cf9b2b8.tar.gz
linux-8d856c72b42d585fb17a8aa18454e03a0cf9b2b8.tar.bz2
linux-8d856c72b42d585fb17a8aa18454e03a0cf9b2b8.zip
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.com Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Reviewed-by: Andrew 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/9p/client.c')
-rw-r--r--net/9p/client.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 21e6df1cc70f..18c5271910dc 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -198,8 +198,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
pr_info("Could not find request transport: %s\n",
s);
ret = -EINVAL;
- kfree(s);
- goto free_and_return;
}
kfree(s);
break;
@@ -214,13 +212,12 @@ static int parse_opts(char *opts, struct p9_client *clnt)
"problem allocating copy of version arg\n");
goto free_and_return;
}
- ret = get_protocol_version(s);
- if (ret == -EINVAL) {
- kfree(s);
- goto free_and_return;
- }
+ r = get_protocol_version(s);
+ if (r < 0)
+ ret = r;
+ else
+ clnt->proto_version = r;
kfree(s);
- clnt->proto_version = ret;
break;
default:
continue;