dm verity: set DM_TARGET_SINGLETON feature flag
authorFan Wu <wufan@linux.microsoft.com>
Tue, 30 Jan 2024 22:37:00 +0000 (14:37 -0800)
committerMike Snitzer <snitzer@kernel.org>
Tue, 20 Feb 2024 19:22:55 +0000 (14:22 -0500)
The device-mapper has a flag to mark targets as singleton, which is a
required flag for immutable targets. Without this flag, multiple
dm-verity targets can be added to a mapped device, which has no
practical use cases and will let dm_table_get_immutable_target return
NULL. This patch adds the missing flag, restricting only one
dm-verity target per mapped device.

Signed-off-by: Fan Wu <wufan@linux.microsoft.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-verity-target.c

index 01ec71dcbc7d95a22d95052b8a18e8c651875cc6..6b8f9698488e7864beda98c7b8f3cb4867993229 100644 (file)
@@ -1566,7 +1566,7 @@ int dm_verity_get_root_digest(struct dm_target *ti, u8 **root_digest, unsigned i
 
 static struct target_type verity_target = {
        .name           = "verity",
-       .features       = DM_TARGET_IMMUTABLE,
+       .features       = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE,
        .version        = {1, 10, 0},
        .module         = THIS_MODULE,
        .ctr            = verity_ctr,