From fe7fa3390a380edff11e85cf9a6fe979f99096b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Tue, 19 Aug 2014 18:16:47 +0200 Subject: [PATCH 02/15] block: vhdx - add error check Message-id: <124fe1958f92a285960c59f7bcea5378eee149a5.1408471833.git.jcody@redhat.com> Patchwork-id: 60628 O-Subject: [PATCH qemu-kvm-rhev RHEV7.1 1/2] block: vhdx - add error check Bugzilla: 1126976 RH-Acked-by: dgibson RH-Acked-by: Markus Armbruster RH-Acked-by: Stefan Hajnoczi This add an error check for an invalid descriptor entry signature, when flushing the log descriptor entries. Signed-off-by: Jeff Cody Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf (cherry picked from commit 349592e0b9112171500e940dd921bb96cfc496d2) --- block/vhdx-log.c | 5 +++++ 1 file changed, 5 insertions(+) Signed-off-by: Miroslav Rezanina --- block/vhdx-log.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/block/vhdx-log.c b/block/vhdx-log.c index a77c040..7c2630d 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -435,6 +435,11 @@ static int vhdx_log_flush_desc(BlockDriverState *bs, VHDXLogDescriptor *desc, /* write 'count' sectors of sector */ memset(buffer, 0, VHDX_LOG_SECTOR_SIZE); count = desc->zero_length / VHDX_LOG_SECTOR_SIZE; + } else { + error_report("Invalid VHDX log descriptor entry signature 0x%" PRIx32, + desc->signature); + ret = -EINVAL; + goto exit; } file_offset = desc->file_offset; -- 1.7.1