]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
libceph: stop parsing when a bad int arg is detected
authorChengguang Xu <cgxu519@gmx.com>
Wed, 27 Jun 2018 13:05:08 +0000 (21:05 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 2 Aug 2018 19:26:11 +0000 (21:26 +0200)
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: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/ceph_common.c

index 584fdbef2088cf7eaa6ad8fea103dc6aa42b6ce9..1677a6132034f2c2d8b77f9998d05c845b805d49 100644 (file)
@@ -379,7 +379,7 @@ ceph_parse_options(char *options, const char *dev_name,
 
        /* parse mount options */
        while ((c = strsep(&options, ",")) != NULL) {
-               int token, intval, ret;
+               int token, intval;
                if (!*c)
                        continue;
                err = -EINVAL;
@@ -394,11 +394,11 @@ ceph_parse_options(char *options, const char *dev_name,
                        continue;
                }
                if (token < Opt_last_int) {
-                       ret = match_int(&argstr[0], &intval);
-                       if (ret < 0) {
+                       err = match_int(&argstr[0], &intval);
+                       if (err < 0) {
                                pr_err("bad mount option arg (not int) "
                                       "at '%s'\n", c);
-                               continue;
+                               goto out;
                        }
                        dout("got int token %d val %d\n", token, intval);
                } else if (token > Opt_last_int && token < Opt_last_string) {