projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
521b2b5
)
qcow2: Catch bdrv_getlength() error
author
Max Reitz
<mreitz@redhat.com>
Tue, 29 Apr 2014 17:03:13 +0000
(19:03 +0200)
committer
Kevin Wolf
<kwolf@redhat.com>
Wed, 30 Apr 2014 12:46:17 +0000
(14:46 +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 <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-refcount.c
patch
|
blob
|
history
diff --git
a/block/qcow2-refcount.c
b/block/qcow2-refcount.c
index d2cb6a877563309e60c8dd95e5280b5bf087f3d6..e79895d11dcb0b793d7eb8e4fe5e42e8714018e4 100644
(file)
--- 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++;