qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH V6 5/5] blockdev: Add infinite loop check in drive_i


From: Xu Wang
Subject: [Qemu-devel] [PATCH V6 5/5] blockdev: Add infinite loop check in drive_init()
Date: Tue, 5 Nov 2013 22:09:21 -0500

Check the backing file for a loop during image boot, to avoid a lack or
response or segfault.

Signed-off-by: Xu Wang <address@hidden>
---
 blockdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index b260477..7c0927f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -510,6 +510,12 @@ static DriveInfo *blockdev_init(QDict *bs_opts,
 
     bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
 
+    /* Add backing file loop check */
+    if (!bdrv_backing_chain_okay(file, drv ? drv->format_name : NULL)) {
+        error_report("drive_init: backing file loop check failed");
+        goto err;
+    }
+
     QINCREF(bs_opts);
     ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error);
 
-- 
1.8.1.4




reply via email to

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