Blob Blame History Raw
From fe7fa3390a380edff11e85cf9a6fe979f99096b7 Mon Sep 17 00:00:00 2001
From: Jeffrey Cody <jcody@redhat.com>
Date: Tue, 19 Aug 2014 18:16:47 +0200
Subject: [PATCH 02/32] 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 <dgibson@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

This add an error check for an invalid descriptor entry signature,
when flushing the log descriptor entries.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 349592e0b9112171500e940dd921bb96cfc496d2)
---
 block/vhdx-log.c | 5 +++++
 1 file changed, 5 insertions(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/vhdx-log.c | 5 +++++
 1 file changed, 5 insertions(+)

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.8.3.1