From 75dd3b9ecb027e90261ed4052e155e0c1236d717 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 15 Jun 2016 22:27:08 +0200 Subject: [PATCH] dm raid: more restricting data_offset value checks Signed-off-by: Heinz Mauelshagen Signed-off-by: Mike Snitzer --- drivers/md/dm-raid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index a38298589db8..b1dbf28f36d2 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -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; }