From: Luca Boccassi Date: Tue, 10 Dec 2019 11:21:43 +0000 (+0000) Subject: verity: ensure that hash_device and root_hash[_file] are passed together or not at all X-Git-Tag: v2.35-rc1~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe8358bf052b8ac3ceae5381674c344ee607af8f;p=thirdparty%2Futil-linux.git verity: ensure that hash_device and root_hash[_file] are passed together or not at all 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. --- diff --git a/libmount/src/context_veritydev.c b/libmount/src/context_veritydev.c index 42745068f6..3fbe2f343a 100644 --- a/libmount/src/context_veritydev.c +++ b/libmount/src/context_veritydev.c @@ -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;