Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUSUe-0002E0-P3 for qemu-devel@nongnu.org; Tue, 03 Feb 2009 16:07:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUSUe-0002DV-3b for qemu-devel@nongnu.org; Tue, 03 Feb 2009 16:07:40 -0500 Received: from [199.232.76.173] (port=49392 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUSUd-0002DO-Uv for qemu-devel@nongnu.org; Tue, 03 Feb 2009 16:07:39 -0500 Received: from mx2.redhat.com ([66.187.237.31]:52814) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUSUc-0006Qd-Bw for qemu-devel@nongnu.org; Tue, 03 Feb 2009 16:07:39 -0500 Content-Type: text/plain; charset=UTF-8 From: Eduardo Habkost Date: Tue, 03 Feb 2009 19:07:20 -0200 Message-Id: <1233691755-sup-1057@blackpad> Subject: [Qemu-devel] [PATCH] qemu: Don't try to read passwords before monitor setup Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel 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 --- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vl.c b/vl.c index 3676537..07700e8 100644 --- a/vl.c +++ b/vl.c @@ -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; -- 1.6.1 -- Eduardo