Add backing file loop check before execute change backing file for qed format.
Signed-off-by: Xu Wang <cngesa...@gmail.com> --- block/qed.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block/qed.c b/block/qed.c index f767b05..79c2875 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1468,6 +1468,13 @@ static int bdrv_qed_change_backing_file(BlockDriverState *bs, return -ENOTSUP; } + /* Check if loop exists in backing files chain after changed */ + if (bdrv_backing_file_loop_check(bs->filename, + bs->drv ? bs->drv->format_name : NULL, + backing_file, backing_fmt)) { + return -EIO; + } + memcpy(&new_header, &s->header, sizeof(new_header)); new_header.features &= ~(QED_F_BACKING_FILE | -- 1.8.1.4