qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-stable] [PATCH 1/2] hmp: block qemu-io command for device without


From: Denis V. Lunev
Subject: [Qemu-stable] [PATCH 1/2] hmp: block qemu-io command for device without media
Date: Tue, 28 Nov 2017 15:10:54 +0300

In this case blk->bs == NULL and the code will just crash. Emulate error
on that path.

Signed-off-by: Denis V. Lunev <address@hidden>
CC: "Dr. David Alan Gilbert" <address@hidden>
CC: Kevin Wolf <address@hidden>
CC: Stefan Hajnoczi <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]