mirror of https://github.com/xemu-project/xemu.git
qcow2: initialize metadata before inserting in cluster_allocs
QCow2Meta structure was inserted into list before many fields are initialized. Currently is not a problem cause all occur in a lock but if qcow2_alloc_clusters would in a future unlock this lock some issues could arise. Initializing fields before inserting fix the problem. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
25ad22bc4e
commit
05140499d3
|
@ -806,6 +806,11 @@ again:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* save info needed for meta data update */
|
||||||
|
m->offset = offset;
|
||||||
|
m->n_start = n_start;
|
||||||
|
m->nb_clusters = nb_clusters;
|
||||||
|
|
||||||
QLIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight);
|
QLIST_INSERT_HEAD(&s->cluster_allocs, m, next_in_flight);
|
||||||
|
|
||||||
/* allocate a new cluster */
|
/* allocate a new cluster */
|
||||||
|
@ -816,11 +821,6 @@ again:
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save info needed for meta data update */
|
|
||||||
m->offset = offset;
|
|
||||||
m->n_start = n_start;
|
|
||||||
m->nb_clusters = nb_clusters;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
|
ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
Loading…
Reference in New Issue