]> git.ipfire.org Git - thirdparty/qemu.git/commit
qcow2: fix possible corruption when reading multiple clusters
authorPeter Lieven <pl@kamp.de>
Tue, 12 Nov 2013 12:48:07 +0000 (13:48 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 9 Dec 2013 17:40:30 +0000 (11:40 -0600)
commit4d2f39a918ab4ccac7255da143b4322a9b4b204a
treed118c29061757c103bf4550cccafe52a91557217
parent4a5bf69f78e20a64f35770612ee897da4d80082e
qcow2: fix possible corruption when reading multiple clusters

if multiple sectors spanning multiple clusters are read the
function count_contiguous_clusters should ensure that the
cluster type should not change between the clusters.

Especially the for-loop should break when we have one
or more normal clusters followed by a compressed cluster.

Unfortunately the wrong macro was used in the mask to
compare the flags.

This was discovered while debugging a data corruption
issue when converting a compressed qcow2 image to raw.
qemu-img reads 2MB chunks which span multiple clusters.

CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 78a52ad5acca7053b774fcc80290e7b7e224c80a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2-cluster.c