- Fix qcow2 image corruption (#496642)

This commit is contained in:
Mark McLoughlin 2009-04-20 13:52:28 +00:00
parent 664b398980
commit 749234291f
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] qcow2 corruption: Fix alloc_cluster_link_l2
This patch fixes a qcow2 corruption bug introduced in SVN Rev 5861. L2 tables
are big endian, so entries must be converted before being passed to functions.
This bug is easy to trigger. The following script will create and destroy a
qcow2 image (the header is gone after three loop iterations):
#!/bin/bash
qemu-img create -f qcow2 test.qcow 1M
for i in $(seq 1 10); do
qemu-system-x86_64 -hda test.qcow -monitor stdio > /dev/null 2>&1 <<EOF
savevm test-$i
quit
EOF
done
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block-qcow2.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff -up qemu-kvm-0.10/qemu/block-qcow2.c.qcow2-corruption qemu-kvm-0.10/qemu/block-qcow2.c
--- qemu-kvm-0.10/qemu/block-qcow2.c.qcow2-corruption 2009-04-20 14:41:22.000000000 +0100
+++ qemu-kvm-0.10/qemu/block-qcow2.c 2009-04-20 14:41:54.000000000 +0100
@@ -912,7 +912,7 @@ static int alloc_cluster_link_l2(BlockDr
goto err;
for (i = 0; i < j; i++)
- free_any_clusters(bs, old_cluster[i], 1);
+ free_any_clusters(bs, be64_to_cpu(old_cluster[i]), 1);
ret = 0;
err:

View File

@ -1,7 +1,7 @@
Summary: QEMU is a FAST! processor emulator
Name: qemu
Version: 0.10
Release: 10%{?dist}
Release: 11%{?dist}
# I have mistakenly thought the revision name would be 1.0.
# So 0.10 series get Epoch = 1
Epoch: 2
@ -38,6 +38,7 @@ Patch13: qemu-roms-more-room-fix-vga-align.patch
Patch14: qemu-bios-bigger-roms.patch
Patch15: qemu-fix-display-breakage.patch
Patch16: qemu-fix-qcow2-2TB.patch
Patch17: qemu-fix-qcow2-corruption.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
@ -224,6 +225,7 @@ such as kvmtrace and kvm_stat.
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%build
# systems like rhel build system does not have a recent enough linker so
@ -465,6 +467,9 @@ fi
%{_mandir}/man1/qemu-img.1*
%changelog
* Mon Apr 20 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.10-11
- Fix qcow2 image corruption (#496642)
* Sun Apr 19 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.10-10
- Run sysconfig.modules from %post on x86_64 too (#494739)