qemu: Don't try to read passwords before monitor setup
PATCH 1/1 qemu: Don't try to read passwords before monitor setup
drive_init() calls qemu_key_check(), but it doesn't make sense to call it before the monitor was set up. This makes qemu hang forever waiting for a password on a monitor that doesn't exist yet.
This can be reproduced by running:
$ qemu-img create -e -f qcow2 encrypted.img 10M Formatting 'encrypted.img', fmt=qcow2, encrypted, size=10240 kB $ qemu-system-x86_64 -drive file=encrypted.img -monitor stdio [qemu hangs]
Removing the qemu_key_check() call on drive_init() will make the password to be read at a more appropriate time, at read_passwords().
Signed-off-by Eduardo Habkost <[email protected]>
--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
@@ -2552,7 +2552,7 @@ static int drive_init(struct drive_opt *arg, int snapshot, bdrv_flags |=BDRV_O_CACHE_WB ; else if (cache == 3) /* not specified */ bdrv_flags |= BDRV_O_CACHE_DEF; - if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) { + if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) {fprintf (stderr,"qemu: could not open disk image %s\n" , file);return -1 ;
Signature · 3 lines
1.6.1 -- Eduardo