[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [STABLE PATCH 6/6] qcow2: Fix corruption after error in upd
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [STABLE PATCH 6/6] qcow2: Fix corruption after error in update_refcount |
Date: |
Fri, 28 May 2010 20:01:32 +0200 |
After it is done with updating refcounts in the cache, update_refcount writes
all changed entries to disk. If a refcount block allocation fails, however,
there was no change yet and therefore first_index = last_index = -1. Don't
treat -1 as a normal sector index (resulting in a 512 byte write!) but return
without updating anything in this case.
Signed-off-by: Kevin Wolf <address@hidden>
(cherry picked from commit 86fa8da83771238de55dc44819a1a27bafef5353)
---
block/qcow2-refcount.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index fa78e46..465d5d3 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -402,6 +402,10 @@ static int write_refcount_block_entries(BDRVQcowState *s,
return 0;
}
+ if (first_index < 0) {
+ return 0;
+ }
+
first_index &= ~(REFCOUNTS_PER_SECTOR - 1);
last_index = (last_index + REFCOUNTS_PER_SECTOR)
& ~(REFCOUNTS_PER_SECTOR - 1);
--
1.6.6.1
- [Qemu-devel] [STABLE PULL 0/6] Block patches for 0.12.x, Kevin Wolf, 2010/05/28
- [Qemu-devel] [STABLE PATCH 6/6] qcow2: Fix corruption after error in update_refcount,
Kevin Wolf <=
- [Qemu-devel] [STABLE PATCH 4/6] block: Fix multiwrite with overlapping requests, Kevin Wolf, 2010/05/28
- [Qemu-devel] [STABLE PATCH 5/6] qcow2: Fix corruption after refblock allocation, Kevin Wolf, 2010/05/28
- [Qemu-devel] [STABLE PATCH 3/6] qcow2: Fix error handling in l2_allocate, Kevin Wolf, 2010/05/28
- [Qemu-devel] [STABLE PATCH 2/6] qcow2: Clear L2 table cache after write error, Kevin Wolf, 2010/05/28
- [Qemu-devel] [STABLE PATCH 1/6] ide: Fix ide_dma_cancel, Kevin Wolf, 2010/05/28