提交 17173c82 编写于 作者: C Chengguang Xu 提交者: Ilya Dryomov

libceph: stop parsing when a bad int arg is detected

There is no reason to continue option parsing after detecting
bad option.

[ Return match_int() errors from ceph_parse_options() to match the
  behaviour of parse_rbd_opts_token() and parse_fsopt_token(). ]
Signed-off-by: NChengguang Xu <cgxu519@gmx.com>
Reviewed-by: NIlya Dryomov <idryomov@gmail.com>
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
上级 c9ed51c9
...@@ -379,7 +379,7 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -379,7 +379,7 @@ ceph_parse_options(char *options, const char *dev_name,
/* parse mount options */ /* parse mount options */
while ((c = strsep(&options, ",")) != NULL) { while ((c = strsep(&options, ",")) != NULL) {
int token, intval, ret; int token, intval;
if (!*c) if (!*c)
continue; continue;
err = -EINVAL; err = -EINVAL;
...@@ -394,11 +394,11 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -394,11 +394,11 @@ ceph_parse_options(char *options, const char *dev_name,
continue; continue;
} }
if (token < Opt_last_int) { if (token < Opt_last_int) {
ret = match_int(&argstr[0], &intval); err = match_int(&argstr[0], &intval);
if (ret < 0) { if (err < 0) {
pr_err("bad mount option arg (not int) " pr_err("bad mount option arg (not int) "
"at '%s'\n", c); "at '%s'\n", c);
continue; goto out;
} }
dout("got int token %d val %d\n", token, intval); dout("got int token %d val %d\n", token, intval);
} else if (token > Opt_last_int && token < Opt_last_string) { } else if (token > Opt_last_int && token < Opt_last_string) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册