From: Heinz Mauelshagen <[email-masked]>

This patch adds checks to the dirty log creation for region size to be
larger than 2 sectors and to be a power of 2.

[Missing page size check? Move _check_region_size()?]

Signed-off-by: Heinz Mauelshagen <[email-masked]>

---
 drivers/md/dm-log.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.28-rc7/drivers/md/dm-log.c
===================================================================
--- linux-2.6.28-rc7.orig/drivers/md/dm-log.c	2008-12-03 19:33:14.000000000 +0000
+++ linux-2.6.28-rc7/drivers/md/dm-log.c	2008-12-03 20:10:32.000000000 +0000
@@ -395,8 +395,10 @@ static int create_log_context(struct dm_
 		}
 	}
 
-	if (sscanf(argv[0], "%u", &region_size) != 1) {
-		DMWARN("invalid region size string");
+	if (sscanf(argv[0], "%u", &region_size) != 1 ||
+	    region_size < 2 ||
+	    (region_size & (region_size - 1))) {
+		DMWARN("invalid region size");
 		return -EINVAL;
 	}