From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KiXba-0004XT-23 for qemu-devel@nongnu.org; Wed, 24 Sep 2008 12:52:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KiXbZ-0004Ww-Ap for qemu-devel@nongnu.org; Wed, 24 Sep 2008 12:52:45 -0400 Received: from [199.232.76.173] (port=41902 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiXbZ-0004Wg-5e for qemu-devel@nongnu.org; Wed, 24 Sep 2008 12:52:45 -0400 Received: from ag-out-0708.google.com ([72.14.246.250]:7919) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KiXbX-00054T-Ir for qemu-devel@nongnu.org; Wed, 24 Sep 2008 12:52:43 -0400 Received: by ag-out-0708.google.com with SMTP id 31so2119147agc.5 for ; Wed, 24 Sep 2008 09:52:42 -0700 (PDT) Message-ID: <48DA701E.6040504@codemonkey.ws> Date: Wed, 24 Sep 2008 11:51:42 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset() References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 Shahar Frank wrote: > Hi All, > > During the debugging of the new revision of the zero dedup patch I > stepped on the following bug in block-qcow2.c:alloc_cluster_offset(). I > am not sure what the exact damage this bug can do, but it may be very > nasty because you way not notice it effects until you will do some > snapshot operations or similar actions that rely on the reference > counting. > > The bug is easy to spot using the new "check" verb I added to the > qemu-img in one of the previous patches. I will resend the qemu-img > patch again with the new version of the zero dedup. > > Signed-off-by: Shahar Frank > Applied. Thanks. Regards, Anthony Liguori > Index: block-qcow2.c > =================================================================== > --- block-qcow2.c (revision 5312) > +++ block-qcow2.c (working copy) > @@ -917,7 +917,7 @@ > /* how many free clusters ? */ > > while (i < nb_clusters) { > - cluster_offset = l2_table[l2_index + i]; > + cluster_offset = be64_to_cpu(l2_table[l2_index + i]); > if (cluster_offset != 0) > break; > i++; > >