]> git.proxmox.com Git - qemu.git/commitdiff
qcow2: Fix error handling in qcow2_alloc_cluster_offset
authorKevin Wolf <kwolf@redhat.com>
Wed, 18 Apr 2012 14:18:14 +0000 (16:18 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 19 Apr 2012 14:03:27 +0000 (16:03 +0200)
If do_alloc_cluster_offset() fails, the error handling code tried to
remove the request from the in-flight queue, to which it wasn't added
yet, resulting in a NULL pointer dereference.

m->nb_clusters really only becomes != 0 when the request is in the list.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-cluster.c

index cbd224dc469ffe018e761120b470da8121b3ead7..dcf70a24d3ef098fd8b127f162d032ec824ca946 100644 (file)
@@ -931,7 +931,7 @@ again:
 fail:
     qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
 fail_put:
-    if (nb_clusters > 0) {
+    if (m->nb_clusters > 0) {
         QLIST_REMOVE(m, next_in_flight);
     }
     return ret;