[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/6] qcow2: Catch bdrv_getlength() error
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 3/6] qcow2: Catch bdrv_getlength() error |
Date: |
Tue, 29 Apr 2014 19:03:13 +0200 |
The call to bdrv_getlength() from qcow2_check_refcounts() may result in
an error. Check this and abort if necessary.
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2-refcount.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index e6fc30e..76da3ab 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1487,6 +1487,11 @@ int qcow2_check_refcounts(BlockDriverState *bs,
BdrvCheckResult *res,
int ret;
size = bdrv_getlength(bs->file);
+ if (size < 0) {
+ res->check_errors++;
+ return size;
+ }
+
nb_clusters = size_to_clusters(s, size);
if (nb_clusters > INT_MAX) {
res->check_errors++;
--
1.9.2
- [Qemu-devel] [PATCH 0/6] block: Several fixes, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH 1/6] qcow2: Avoid overflow in alloc_clusters_noref(), Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH 2/6] block: Use correct width in format strings, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH 3/6] qcow2: Catch bdrv_getlength() error,
Max Reitz <=
- [Qemu-devel] [PATCH 4/6] qcow2: Check min_size in qcow2_grow_l1_table(), Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH 5/6] block/bochs: Fix error handling for seek_to_sector(), Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH 6/6] block/vdi: Error out immediately in vdi_create(), Max Reitz, 2014/04/29
- Re: [Qemu-devel] [PATCH 0/6] block: Several fixes, Kevin Wolf, 2014/04/30