From: Mikulas Patocka If for any reason dm_merge_bvec() is given an offset beyond the end of the device, avoid an oops and always allow one page to be added to an empty bio. We'll reject the I/O later after the bio is submitted. Signed-off-by: Mikulas Patocka Signed-off-by: Alasdair G Kergon --- drivers/md/dm.c | 3 +++ 1 files changed, 3 insertions(+) Index: linux-2.6.27-rc7/drivers/md/dm.c =================================================================== --- linux-2.6.27-rc7.orig/drivers/md/dm.c 2008-10-01 13:04:15.000000000 +0100 +++ linux-2.6.27-rc7/drivers/md/dm.c 2008-10-01 13:04:15.000000000 +0100 @@ -843,6 +843,8 @@ static int dm_merge_bvec(struct request_ goto out; ti = dm_table_find_target(map, bvm->bi_sector); + if (!dm_target_is_valid(ti)) + goto out_table; /* * Find maximum amount of I/O that won't need splitting @@ -861,6 +863,7 @@ static int dm_merge_bvec(struct request_ if (max_size && ti->type->merge) max_size = ti->type->merge(ti, bvm, biovec, max_size); +out_table: dm_table_put(map); out: