qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset()


From: Shahar Frank
Subject: [Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset()
Date: Wed, 24 Sep 2008 09:38:29 -0700

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 <address@hidden>

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++;

Attachment: alloc_cluster_offset-fix.patch
Description: alloc_cluster_offset-fix.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]