From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSRss-0002BX-IQ for qemu-devel@nongnu.org; Thu, 10 May 2012 07:50:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSRsn-0006Vq-Py for qemu-devel@nongnu.org; Thu, 10 May 2012 07:50:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSRsn-0006VO-II for qemu-devel@nongnu.org; Thu, 10 May 2012 07:50:09 -0400 From: Kevin Wolf Date: Thu, 10 May 2012 13:49:29 +0200 Message-Id: <1336650574-12835-26-git-send-email-kwolf@redhat.com> In-Reply-To: <1336650574-12835-1-git-send-email-kwolf@redhat.com> References: <1336650574-12835-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 25/30] stream: pass new base image format to bdrv_change_backing_file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Paolo Bonzini 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 Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- block/stream.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/block/stream.c b/block/stream.c index 930e3cf..25f98e4 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); } -- 1.7.6.5