diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-05-08 16:51:55 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-05-10 11:01:59 +0200 |
commit | f6133def92a3575c9abf57d066108df53e67629e (patch) | |
tree | 3dd24a9140875c5649b35f4469ebace7220eec66 | |
parent | 6e34360973ffe1effaa65978a2afbf8cc5a5d7a9 (diff) |
stream: pass new base image format to bdrv_change_backing_file
When an image is modified to point to the new backing file, the backing
file format is set to NULL, which means auto-probe. This is wrong, in
fact it is a small security problem.
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block/stream.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/block/stream.c b/block/stream.c index 930e3cf37b..25f98e493c 100644 --- a/block/stream.c +++ b/block/stream.c @@ -235,11 +235,14 @@ wait: } if (!block_job_is_cancelled(&s->common) && sector_num == end && ret == 0) { - const char *base_id = NULL; + const char *base_id = NULL, *base_fmt = NULL; if (base) { base_id = s->backing_file_id; + if (base->drv) { + base_fmt = base->drv->format_name; + } } - ret = bdrv_change_backing_file(bs, base_id, NULL); + ret = bdrv_change_backing_file(bs, base_id, base_fmt); close_unused_images(bs, base, base_id); } |