]> Git Repo - qemu.git/commitdiff
fix bug in block-qcow2.c:alloc_cluster_offset() (Shahar Frank)
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Wed, 24 Sep 2008 16:52:15 +0000 (16:52 +0000)
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Wed, 24 Sep 2008 16:52:15 +0000 (16:52 +0000)
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 <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5313 c046a42c-6fe2-441c-8c8c-71466251a162

block-qcow2.c

index 5f0fbe8f9e8e4e5fd0fb3aadbb1b43e768b3b49f..693cd77278bd7659d23c51599490f443fcfceef8 100644 (file)
@@ -917,7 +917,7 @@ static uint64_t alloc_cluster_offset(BlockDriverState *bs,
             /* 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++;
This page took 0.027613 seconds and 4 git commands to generate.