block/vhdx: Support vhdx image only with 512 bytes logical sector size

block/vhdx uses qemu block layer where sector size is always 512 bytes.
This may have issues  with 4K logical sector sized vhdx image.

For e.g qemu-img convert on such images fails with following assert:

$qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <=
qiov->size' failed.
Aborted

This patch adds an check to return ENOTSUP for vhdx images which
have logical sector size other than 512 bytes.

Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Message-Id: <1596794594-44531-1-git-send-email-swapnil.ingle@nutanix.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Swapnil Ingle 2020-08-07 10:03:23 +00:00 committed by Max Reitz
parent 33fe08fcaf
commit 83a6a90009

View File

@ -816,9 +816,9 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
goto exit; goto exit;
} }
/* only 2 supported sector sizes */ /* Currently we only support 512 */
if (s->logical_sector_size != 512 && s->logical_sector_size != 4096) { if (s->logical_sector_size != 512) {
ret = -EINVAL; ret = -ENOTSUP;
goto exit; goto exit;
} }