* [Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset()
@ 2008-09-24 16:38 Shahar Frank
2008-09-24 16:51 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Shahar Frank @ 2008-09-24 16:38 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]
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 <shaharf@qumranet.com>
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 #2: alloc_cluster_offset-fix.patch --]
[-- Type: application/octet-stream, Size: 482 bytes --]
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++;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset()
2008-09-24 16:38 [Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset() Shahar Frank
@ 2008-09-24 16:51 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2008-09-24 16:51 UTC (permalink / raw)
To: qemu-devel
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 <shaharf@qumranet.com>
>
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++;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-24 16:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24 16:38 [Qemu-devel][PATCH][FIX] fix bug in block-qcow2.c:alloc_cluster_offset() Shahar Frank
2008-09-24 16:51 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).