diff mbox series

[kvmtool,v2,1/9] qcow: Fix qcow1 exit fault

Message ID 20190404132050.37309-2-jean-philippe.brucker@arm.com (mailing list archive)
State New, archived
Headers show
Series Disk fixes and AIO reset | expand

Commit Message

Jean-Philippe Brucker April 4, 2019, 1:20 p.m. UTC
Even though qcow1 doesn't use the refcount table, the cleanup path still
attempts to iterate over its LRU list. Initialize the list to avoid a
segfault on exit.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
---
 disk/qcow.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/disk/qcow.c b/disk/qcow.c
index 64cf9270a..bed70c65c 100644
--- a/disk/qcow.c
+++ b/disk/qcow.c
@@ -1437,6 +1437,7 @@  static struct disk_image *qcow1_probe(int fd, bool readonly)
 
 	l1t->root = (struct rb_root)RB_ROOT;
 	INIT_LIST_HEAD(&l1t->lru_list);
+	INIT_LIST_HEAD(&q->refcount_table.lru_list);
 
 	h = q->header = qcow1_read_header(fd);
 	if (!h)