Skip to content
Snippets Groups Projects
Commit 05140499 authored by Frediano Ziglio's avatar Frediano Ziglio Committed by Kevin Wolf
Browse files

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: default avatarFrediano Ziglio <freddy77@gmail.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 25ad22bc
No related branches found
No related tags found
No related merge requests found
...@@ -806,6 +806,11 @@ again: ...@@ -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: ...@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment