From: Luca Boccassi Date: Tue, 7 Jan 2020 20:29:57 +0000 (+0000) Subject: libmount: do not obscure return code when checking verity options X-Git-Tag: v2.35~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7924c4f153bbf13ea382140f0b5ecba9c945004;p=thirdparty%2Futil-linux.git libmount: do not obscure return code when checking verity options In some corner cases, the return code was being overwritten without being checked --- diff --git a/libmount/src/context_veritydev.c b/libmount/src/context_veritydev.c index 2ef437642c..fd5662ce56 100644 --- a/libmount/src/context_veritydev.c +++ b/libmount/src/context_veritydev.c @@ -153,15 +153,15 @@ int mnt_context_setup_veritydev(struct libmnt_context *cxt) } } - if (root_hash && root_hash_file) { + if (!rc && root_hash && root_hash_file) { DBG(VERITY, ul_debugobj(cxt, "verity.roothash and verity.roothashfile are mutually exclusive")); rc = -EINVAL; - } else if (root_hash_file) { + } else if (!rc && root_hash_file) { rc = ul_path_read_string(NULL, &root_hash, root_hash_file); rc = rc < 1 ? rc : 0; } - if (!hash_device || !root_hash) { + if (!rc && (!hash_device || !root_hash)) { DBG(VERITY, ul_debugobj(cxt, "verity.hashdevice and one of verity.roothash or verity.roothashfile are mandatory")); rc = -EINVAL; }