dm raid: more restricting data_offset value checks

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
Heinz Mauelshagen 2016-06-15 22:27:08 +02:00 committed by Mike Snitzer
parent 5fa146b25b
commit 75dd3b9ecb
1 changed files with 2 additions and 1 deletions

View 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;
}