dm raid: more restricting data_offset value checks
authorHeinz Mauelshagen <heinzm@redhat.com>
Wed, 15 Jun 2016 20:27:08 +0000 (22:27 +0200)
committerMike Snitzer <snitzer@redhat.com>
Mon, 18 Jul 2016 19:37:19 +0000 (15:37 -0400)
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-raid.c

index a38298589db865a7c57c137275c7044b12ac661f..b1dbf28f36d2c81d6a9f368a2b8e969f05ef4620 100644 (file)
@@ -1221,7 +1221,8 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
                                return -EINVAL;
                        }
                        /* Ensure sensible data offset */
-                       if (value < 0) {
+                       if (value < 0 ||
+                           (value && (value < MIN_FREE_RESHAPE_SPACE || value % to_sector(PAGE_SIZE)))) {
                                rs->ti->error = "Bogus data_offset value";
                                return -EINVAL;
                        }