diff options
author | Anton Nefedov <anton.nefedov@virtuozzo.com> | 2017-11-14 13:16:49 +0300 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2017-11-17 18:21:30 +0100 |
commit | 3e3b838ffeba42eced87595b0a23dc38f7c0c21b (patch) | |
tree | 531933c9528b0a72b3365873f06ce8d31a7f0c1e /block | |
parent | 2b7731938d9279a77d2df62fd9641afc00adbc7c (diff) | |
download | qemu-3e3b838ffeba42eced87595b0a23dc38f7c0c21b.zip qemu-3e3b838ffeba42eced87595b0a23dc38f7c0c21b.tar.gz qemu-3e3b838ffeba42eced87595b0a23dc38f7c0c21b.tar.bz2 |
qcow2: reject unaligned offsets in write compressed
Misaligned compressed write is not supported.
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Message-id: 1510654613-47868-2-git-send-email-anton.nefedov@virtuozzo.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index f2731a7..811b913 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3358,6 +3358,10 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset, return bdrv_truncate(bs->file, cluster_offset, PREALLOC_MODE_OFF, NULL); } + if (offset_into_cluster(s, offset)) { + return -EINVAL; + } + buf = qemu_blockalign(bs, s->cluster_size); if (bytes != s->cluster_size) { if (bytes > s->cluster_size || |