diff --git a/block/ioctl.c b/block/ioctl.c index f856963204f4949f5197c1cb0c0a247ca12c95da..656c8c6ed206f876bbdbd0f240dedf9997a88cf0 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -45,6 +45,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user || pstart < 0 || plength < 0 || partno > 65535) return -EINVAL; } + /* check if partition is aligned to blocksize */ + if (p.start & (bdev_logical_block_size(bdev) - 1)) + return -EINVAL; mutex_lock(&bdev->bd_mutex);