qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated
@ 2013-10-24  7:16 Peter Lieven
  2013-10-24  9:02 ` Eric Blake
  2013-10-24 10:06 ` Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Lieven @ 2013-10-24  7:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, stefanha, Peter Lieven

this adds a check that a dynamic VHD file has not been
accidently truncated (e.g. during transfer or upload).

Signed-off-by: Peter Lieven <pl@kamp.de>
---
v1->v2: used the errp argument as Eric suggested

 block/vpc.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/block/vpc.c b/block/vpc.c
index b5dca39..627d11c 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -260,6 +260,13 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
             }
         }
 
+        if (s->free_data_block_offset > bdrv_getlength(bs->file)) {
+            error_setg(errp, "block-vpc: free_data_block_offset points after "
+                             "the end of file. The image has been truncated.");
+            ret = -EINVAL;
+            goto fail;
+        }
+
         s->last_bitmap_offset = (int64_t) -1;
 
 #ifdef CACHE
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated
  2013-10-24  7:16 [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated Peter Lieven
@ 2013-10-24  9:02 ` Eric Blake
  2013-10-24 10:06 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2013-10-24  9:02 UTC (permalink / raw)
  To: Peter Lieven, qemu-devel; +Cc: kwolf, pbonzini, stefanha

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

On 10/24/2013 08:16 AM, Peter Lieven wrote:
> this adds a check that a dynamic VHD file has not been
> accidently truncated (e.g. during transfer or upload).
> 
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
> v1->v2: used the errp argument as Eric suggested
> 
>  block/vpc.c |    7 +++++++
>  1 file changed, 7 insertions(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated
  2013-10-24  7:16 [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated Peter Lieven
  2013-10-24  9:02 ` Eric Blake
@ 2013-10-24 10:06 ` Kevin Wolf
  2013-10-24 10:09   ` Peter Lieven
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Wolf @ 2013-10-24 10:06 UTC (permalink / raw)
  To: Peter Lieven; +Cc: pbonzini, qemu-devel, stefanha

Am 24.10.2013 um 09:16 hat Peter Lieven geschrieben:
> this adds a check that a dynamic VHD file has not been
> accidently truncated (e.g. during transfer or upload).
> 
> Signed-off-by: Peter Lieven <pl@kamp.de>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated
  2013-10-24 10:06 ` Kevin Wolf
@ 2013-10-24 10:09   ` Peter Lieven
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Lieven @ 2013-10-24 10:09 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: pbonzini, qemu-devel, stefanha

On 24.10.2013 12:06, Kevin Wolf wrote:
> Am 24.10.2013 um 09:16 hat Peter Lieven geschrieben:
>> this adds a check that a dynamic VHD file has not been
>> accidently truncated (e.g. during transfer or upload).
>>
>> Signed-off-by: Peter Lieven <pl@kamp.de>
> Thanks, applied to the block branch.
Can you have a look at:
  block/vpc: fix virtual size for images created with disk2vhd

as well please.

Peter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-24 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-24  7:16 [Qemu-devel] [PATCHv2] block/vpc: check that the image has not been truncated Peter Lieven
2013-10-24  9:02 ` Eric Blake
2013-10-24 10:06 ` Kevin Wolf
2013-10-24 10:09   ` Peter Lieven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).