]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: refuse external verity data in partitioned mode
authorLennart Poettering <lennart@poettering.net>
Wed, 8 Sep 2021 15:30:33 +0000 (17:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Sep 2021 12:15:27 +0000 (14:15 +0200)
Our code doesn't support setting up verity with an external verity data
file unless we operate in non-partitioned mode. Let's refuse this
clearly and early if attempted anyway.

src/shared/dissect-image.c

index 4f398316ae3b4e61a9d9f98e3891955335af192e..480e4a22847af34d1484c18e964344e4bd26b294 100644 (file)
@@ -839,6 +839,10 @@ int dissect_image(
         if (!is_gpt && ((flags & DISSECT_IMAGE_GPT_ONLY) || !is_mbr))
                 return -ENOPKG;
 
+        /* We support external verity data partitions only if the image has no partition table */
+        if (verity && verity->data_path)
+                return -EBADR;
+
         /* Safety check: refuse block devices that carry a partition table but for which the kernel doesn't
          * do partition scanning. */
         r = blockdev_partscan_enabled(fd);