]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
verity: ensure that hash_device and root_hash[_file] are passed together or not at all
authorLuca Boccassi <luca.boccassi@microsoft.com>
Tue, 10 Dec 2019 11:21:43 +0000 (11:21 +0000)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Tue, 10 Dec 2019 12:52:39 +0000 (12:52 +0000)
If a hash device or a roothash are passed for verity usage, both have to be present
or we cannot use them. Make it an error to pass only one of them.

libmount/src/context_veritydev.c

index 42745068f622846e90241128084c67e8492d6552..3fbe2f343ab2d9eb66fe7af527bc7c7bfe1fb0ff 100644 (file)
@@ -127,6 +127,11 @@ int mnt_context_setup_veritydev(struct libmnt_context *cxt)
                rc = rc < 1 ? rc : 0;
        }
 
+       if (!hash_device || !root_hash) {
+               DBG(VERITY, ul_debugobj(cxt, "verity.hashdevice and one of verity.roothash or verity.roothashfile are mandatory"));
+               rc = -EINVAL;
+       }
+
        if (rc)
                goto done;