From patchwork Wed Aug 6 19:54:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 377399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9942E14009C for ; Thu, 7 Aug 2014 05:57:49 +1000 (EST) Received: from localhost ([::1]:40788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF7LH-0006T0-M0 for incoming@patchwork.ozlabs.org; Wed, 06 Aug 2014 15:57:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF7Ik-0003PJ-JI for qemu-devel@nongnu.org; Wed, 06 Aug 2014 15:55:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF7Ie-0005d3-Fr for qemu-devel@nongnu.org; Wed, 06 Aug 2014 15:55:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF7Ie-0005cD-9T for qemu-devel@nongnu.org; Wed, 06 Aug 2014 15:55:04 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76Jt2r2006618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 15:55:03 -0400 Received: from localhost ([10.3.112.16]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76Jt0PY020786 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 6 Aug 2014 15:55:02 -0400 From: Jeff Cody To: qemu-devel@nongnu.org Date: Wed, 6 Aug 2014 15:54:57 -0400 Message-Id: <9c38d02efb0c96e01e1edc6b80ba99f014d5e908.1407353952.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 1/2] block: vhdx - add error check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This add an error check for an invalid descriptor entry signature, when flushing the log descriptor entries. Signed-off-by: Jeff Cody --- 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;