[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V7 3/4] block: Add backing file loop check in change
From: |
Xu Wang |
Subject: |
[Qemu-devel] [PATCH V7 3/4] block: Add backing file loop check in change_backing_file() |
Date: |
Tue, 12 Nov 2013 21:39:39 -0500 |
Backing file loop should be checked before calling change_backing_
file(). If loop appeared, this calling should be stopped and an
error printed.
Signed-off-by: Xu Wang <address@hidden>
---
block.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block.c b/block.c
index c2ed6ef..861b133 100644
--- a/block.c
+++ b/block.c
@@ -2083,6 +2083,11 @@ int bdrv_change_backing_file(BlockDriverState *bs,
return -EINVAL;
}
+ /* Check if loop exists in backing files chain after change */
+ if (!bdrv_backing_chain_okay(backing_file, backing_fmt, bs->filename)) {
+ return -EIO;
+ }
+
if (drv->bdrv_change_backing_file != NULL) {
ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt);
} else {
--
1.8.1.4