]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fs: udf: parse_options: blocksize check
authorFabian Frederick <fabf@skynet.be>
Wed, 29 Jan 2014 09:13:16 +0000 (17:13 +0800)
committerJan Kara <jack@suse.cz>
Mon, 3 Mar 2014 10:30:57 +0000 (11:30 +0100)
Both affs and isofs check for blocksize integrity during
parse_options.Do the same thing for udf.

Valid values : 512, 1024, 2048 or 4096 bytes.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/super.c

index 3306b9f69bedbb5ba2cb4e11b180b2b75e947dd5..ac765386004e771892cfc97743e7941275fb125e 100644 (file)
@@ -505,6 +505,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
        while ((p = strsep(&options, ",")) != NULL) {
                substring_t args[MAX_OPT_ARGS];
                int token;
+               unsigned n;
                if (!*p)
                        continue;
 
@@ -516,7 +517,10 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
                case Opt_bs:
                        if (match_int(&args[0], &option))
                                return 0;
-                       uopt->blocksize = option;
+                       n = option;
+                       if (n != 512 && n != 1024 && n != 2048 && n != 4096)
+                               return 0;
+                       uopt->blocksize = n;
                        uopt->flags |= (1 << UDF_FLAG_BLOCKSIZE_SET);
                        break;
                case Opt_unhide: