]> git.proxmox.com Git - qemu.git/commit
qcow2: Fix corruption after error in update_refcount
authorKevin Wolf <kwolf@redhat.com>
Fri, 28 May 2010 10:21:27 +0000 (12:21 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 9 Jun 2010 16:36:09 +0000 (18:36 +0200)
commita513171f809da4e83800e6bd6e7518dd4b190d9f
tree48fb58934d43f18beb23163ea19599a18aa77139
parentff9e1776172a6533e7501eda67a7411fe6988eb6
qcow2: Fix corruption after error in update_refcount

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 <kwolf@redhat.com>
(cherry picked from commit 86fa8da83771238de55dc44819a1a27bafef5353)
block/qcow2-refcount.c