summaryrefslogtreecommitdiff
path: root/block/vdi.c
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2013-01-17 21:45:28 +0100
committerKevin Wolf <kwolf@redhat.com>2013-01-25 18:18:35 +0100
commit0e87ba2ccbf900cc5a56b95e0671e5a5d2c2f6a0 (patch)
tree697d3c33b6cd16e2e5c84c9382a68e69f6d3b58a /block/vdi.c
parent8937f8222c14ab42140a5645c34e17cc620c05bb (diff)
block/vdi: Check for bad signature
vdi_open did not check for a bad signature. This check was only in vdi_probe. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vdi.c')
-rw-r--r--block/vdi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/vdi.c b/block/vdi.c
index 8b768bfa49..257a592ea9 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -392,7 +392,11 @@ static int vdi_open(BlockDriverState *bs, int flags)
header.disk_size &= ~(SECTOR_SIZE - 1);
}
- if (header.version != VDI_VERSION_1_1) {
+ if (header.signature != VDI_SIGNATURE) {
+ logout("bad vdi signature %08x\n", header.signature);
+ ret = -EMEDIUMTYPE;
+ goto fail;
+ } else if (header.version != VDI_VERSION_1_1) {
logout("unsupported version %u.%u\n",
header.version >> 16, header.version & 0xffff);
ret = -ENOTSUP;