From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuuvT-0006Bl-LJ for qemu-devel@nongnu.org; Fri, 17 Apr 2009 16:44:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuuvS-0006At-UR for qemu-devel@nongnu.org; Fri, 17 Apr 2009 16:44:43 -0400 Received: from [199.232.76.173] (port=40290 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuuvS-0006Al-NC for qemu-devel@nongnu.org; Fri, 17 Apr 2009 16:44:42 -0400 Received: from savannah.gnu.org ([199.232.41.3]:46565 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LuuvS-0005aa-D1 for qemu-devel@nongnu.org; Fri, 17 Apr 2009 16:44:42 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LuuvR-0001OC-Sv for qemu-devel@nongnu.org; Fri, 17 Apr 2009 20:44:41 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LuuvR-0001O7-L1 for qemu-devel@nongnu.org; Fri, 17 Apr 2009 20:44:41 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Fri, 17 Apr 2009 20:44:41 +0000 Subject: [Qemu-devel] [7166] qcow2 corruption: Fix alloc_cluster_link_l2 (Kevin Wolf) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 7166 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7166 Author: aliguori Date: 2009-04-17 20:44:41 +0000 (Fri, 17 Apr 2009) Log Message: ----------- qcow2 corruption: Fix alloc_cluster_link_l2 (Kevin Wolf) 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 < Signed-off-by: Anthony Liguori Revision Links: -------------- http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5861 Modified Paths: -------------- branches/stable_0_10/block-qcow2.c Modified: branches/stable_0_10/block-qcow2.c =================================================================== --- branches/stable_0_10/block-qcow2.c 2009-04-17 20:44:06 UTC (rev 7165) +++ branches/stable_0_10/block-qcow2.c 2009-04-17 20:44:41 UTC (rev 7166) @@ -916,7 +916,7 @@ 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: