]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm vdo: add upfront validation for logical size
authorBruce Johnston <bjohnsto@redhat.com>
Tue, 24 Mar 2026 18:06:47 +0000 (14:06 -0400)
committerMikulas Patocka <mpatocka@redhat.com>
Thu, 26 Mar 2026 17:18:25 +0000 (18:18 +0100)
Add a validation check that the logical size passed via the table line
does not exceed MAXIMUM_VDO_LOGICAL_BLOCKS.

Signed-off-by: Bruce Johnston <bjohnsto@redhat.com>
Reviewed-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-vdo/dm-vdo-target.c

index 1065c88a761cb4e037b796b331db29472aa93859..cee6e4edf76810442bab86ddf5c2e88cd3701096 100644 (file)
@@ -792,6 +792,12 @@ static int parse_device_config(int argc, char **argv, struct dm_target *ti,
        struct device_config *config = NULL;
        int result;
 
+       if (logical_bytes > (MAXIMUM_VDO_LOGICAL_BLOCKS * VDO_BLOCK_SIZE)) {
+               handle_parse_error(config, error_ptr,
+                                  "Logical size exceeds the maximum");
+               return VDO_BAD_CONFIGURATION;
+       }
+
        if ((logical_bytes % VDO_BLOCK_SIZE) != 0) {
                handle_parse_error(config, error_ptr,
                                   "Logical size must be a multiple of 4096");