diff options
| author | Mikulas Patocka <mpatocka@redhat.com> | 2018-08-10 11:23:08 -0400 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2018-08-10 11:52:40 -0400 |
| commit | b2f9960fd34e6dddba7975133b84263a2f594a20 (patch) | |
| tree | f163f754a54fbad19bfdb5365c1e8ae3b148b931 | |
| parent | 5b1fe7bec8a8d0cc547a22e7ddc2bd59acd67de4 (diff) | |
| download | linux-dm-b2f9960fd34e6dddba7975133b84263a2f594a20.tar.gz | |
dm table: use logical_block_size of underlying device when verifying start and len
Notice: this object is not reachable from any branch.
It was found that creating a crypt device with 4K sector size ontop of a
device that has a 512b logical_block_size can incorrectly fail:
# modprobe scsi_debug physblk_exp=3 lowest_aligned=1
# cat /sys/block/sda/queue/logical_block_size
512
# dmsetup create crypt0 --table "0 8192 crypt cipher_null-ecb - 0 /dev/sda 1 1 sector_size:4096"
with the error:
device-mapper: table: 253:0: start=1 not aligned to h/w logical block size 4096 of sda
The device_area_is_invalid() logic incorrectly checks the starting
sector offset against the logical block size of the device that is being
created. It needs to be checking the 'start' offset against the
underlying device's logical block size. The same goes for 'len'
checking.
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Notice: this object is not reachable from any branch.
| -rw-r--r-- | drivers/md/dm-table.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 3d0e2c198f061..79bfbcd4cccb7 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -288,7 +288,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev, sector_t dev_size = i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; unsigned short logical_block_size_sectors = - limits->logical_block_size >> SECTOR_SHIFT; + bdev_logical_block_size(bdev) >> SECTOR_SHIFT; char b[BDEVNAME_SIZE]; /* |
