summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBruce Johnston <bjohnsto@redhat.com>2026-03-24 14:06:47 -0400
committerMikulas Patocka <mpatocka@redhat.com>2026-03-26 18:18:25 +0100
commitbeced130a367e0b99fa9424505ee7f07ddea86de (patch)
treed62e674b847de7397a4696e04b567d4555c12114 /drivers
parent2fb98e4170c4a0d9ebe091ca2421121daa352de0 (diff)
downloadlinux-beced130a367e0b99fa9424505ee7f07ddea86de.tar.gz
linux-beced130a367e0b99fa9424505ee7f07ddea86de.zip
dm vdo: add upfront validation for logical size
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-vdo/dm-vdo-target.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-vdo/dm-vdo-target.c b/drivers/md/dm-vdo/dm-vdo-target.c
index 1065c88a761c..cee6e4edf768 100644
--- a/drivers/md/dm-vdo/dm-vdo-target.c
+++ b/drivers/md/dm-vdo/dm-vdo-target.c
@@ -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");