CHROMIUM: md: dm-verity fixed setting error_behavior
authorPaul Taysom <taysom@chromium.org>
Wed, 10 Apr 2013 17:03:40 +0000 (10:03 -0700)
committerChromeBot <chrome-bot@google.com>
Wed, 10 Apr 2013 18:19:36 +0000 (11:19 -0700)
Need to be able to set the error behavior from either the device table
or from the linux command line.

The code only handled setting from the linux command line which
broke the platform_DMVetiryCorruption test. This was not noticed
earlier because of another bug in error handling that was just
recently was fixed which exposed this problem.

Now the code defaults to the command line but overrides from
the device table.

BUG=chromium:229621
TEST=platform_DMVerityCorruption
Signed-off-by: Paul Taysom <taysom@chromium.org>
Change-Id: I32a516deb2bd564b599e73177e479cddec789dfb
Reviewed-on: https://gerrit.chromium.org/gerrit/47744
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
Commit-Queue: Paul Taysom <taysom@chromium.org>

drivers/md/dm-verity.c

index 96e220d..0e48fbf 100644 (file)
@@ -916,7 +916,7 @@ static void pr_args(struct verity_args *args)
        printk(KERN_INFO "VERITY args: version=%d data_device=%s hash_device=%s"
                " data_block_size_bits=%d hash_block_size_bits=%d"
                " num_data_blocks=%lld hash_start_block=%lld"
-               " algorithm=%s digest=%s salt=%s\n",
+               " algorithm=%s digest=%s salt=%s error_behavior=%s\n",
                args->version,
                args->data_device,
                args->hash_device,
@@ -926,7 +926,8 @@ static void pr_args(struct verity_args *args)
                args->hash_start_block,
                args->algorithm,
                args->digest,
-               args->salt);
+               args->salt,
+               args->error_behavior);
 }
 
 /*
@@ -1081,6 +1082,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        int i;
        sector_t hash_position;
 
+       args.error_behavior = error_behavior;
        if (argc == DM_VERITY_NUM_POSITIONAL_ARGS)
                ti->error = positional_args(argc, argv, &args);
        else
@@ -1263,10 +1265,9 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        }
 
        /* chromeos allows setting error_behavior from both the module
-        * parameters and the device args. However, chromeos only uses
-        * the module parametres
+        * parameters and the device args.
         */
-       v->error_behavior = verity_parse_error_behavior(error_behavior);
+       v->error_behavior = verity_parse_error_behavior(args.error_behavior);
        if (v->error_behavior == -1) {
                ti->error = "Bad error_behavior supplied";
                r = -EINVAL;