[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 44/60] qcow2: Fix refcount table size calculation
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PATCH 44/60] qcow2: Fix refcount table size calculation |
Date: |
Mon, 4 Feb 2013 14:40:54 +0400 |
From: Kevin Wolf <address@hidden>
A missing factor for the refcount table entry size in the calculation
could mean that too little memory was allocated for the in-memory
representation of the table, resulting in a buffer overflow.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Michael Tokarev <address@hidden>
Tested-by: Michael Tokarev <address@hidden>
(cherry picked from commit a3548077062dd9dc2701ebffd931ba6eaef40bec)
Signed-off-by: Michael Tokarev <address@hidden>
---
block/qcow2-refcount.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 443c021..645c7c5 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -301,7 +301,8 @@ static int alloc_refcount_block(BlockDriverState *bs,
uint64_t last_table_size;
uint64_t blocks_clusters;
do {
- uint64_t table_clusters = size_to_clusters(s, table_size);
+ uint64_t table_clusters =
+ size_to_clusters(s, table_size * sizeof(uint64_t));
blocks_clusters = 1 +
((table_clusters + refcount_block_clusters - 1)
/ refcount_block_clusters);
--
1.7.10.4
- [Qemu-devel] [PATCH 30/60] MIPS: Correct FCR0 initialization, (continued)
- [Qemu-devel] [PATCH 30/60] MIPS: Correct FCR0 initialization, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 25/60] hw: Fix return value check for bdrv_read, bdrv_write, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 58/60] qxl: save qemu_create_displaysurface_from result, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 50/60] slirp: Don't crash on packets from 0.0.0.0/8., Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 27/60] x86: Fixed incorrect segment base address addition in 64-bits mode, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 49/60] tap: reset vnet header size on open, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 18/60] e1000: flush queue whenever can_receive can go from false to true, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 19/60] fix entry pointer for ELF kernels loaded with -kernel option, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 31/60] linux-user: fix emulation of getdents, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 12/60] intel_hda: do not call msi_reset when only device state needs resetting, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 44/60] qcow2: Fix refcount table size calculation,
Michael Tokarev <=
- [Qemu-devel] [PATCH 43/60] qcow2: Fix avail_sectors in cluster allocation code, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 13/60] usb-audio: fix usb version, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 14/60] fpu/softfloat.c: Return correctly signed values from uint64_to_float32, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 40/60] nbd: fixes to read-only handling, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 60/60] migration: Fix madvise breakage if host and guest have different page sizes, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 39/60] m68k: Return semihosting errno values correctly, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 28/60] Fixes related to processing of qemu's -numa option, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 09/60] ahci: properly reset PxCMD on HBA reset, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 51/60] vmdk: Fix data corruption bug in WRITE and READ handling, Michael Tokarev, 2013/02/04
- [Qemu-devel] [PATCH 59/60] target-xtensa: fix ITLB/DTLB page protection flags, Michael Tokarev, 2013/02/04