In this case blk->bs == NULL and the code will just crash. Emulate error
on that path.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
hmp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hmp.c b/hmp.c
index 35a7041824..cfd1d9ab29 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2336,6 +2336,9 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
} else {
goto fail;
}
+ } else if (!blk_is_available(blk)) {
+ error_setg(&err, "No media in the device '%s'", device);
+ goto fail;
}
aio_context = blk_get_aio_context(blk);
--
2.11.0