[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 26/43] qcow2: Fix refcount table size calculation
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 26/43] qcow2: Fix refcount table size calculation |
Date: |
Mon, 3 Dec 2012 16:08:50 -0600 |
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 Roth <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 5e3f915..96224d1 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.9.5
- [Qemu-stable] [PATCH 35/43] iscsi: fix segfault in url parsing, (continued)
- [Qemu-stable] [PATCH 35/43] iscsi: fix segfault in url parsing, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 36/43] iscsi: fix deadlock during login, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 37/43] iscsi: do not assume device is zero initialized, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 38/43] virtio-scsi: Fix some endian bugs with virtio-scsi, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 39/43] virtio-scsi: Fix subtle (guest) endian bug, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 40/43] qxl: reload memslots after migration, when qxl is in UNDEFINED mode, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 41/43] usb: fail usbdevice_create() when there is no USB bus, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 42/43] stream: fix ratelimit_set_speed, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 43/43] e1000: Discard packets that are too long if !SBP and !LPE, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 27/43] tci: Fix type of tci_read_label, Michael Roth, 2012/12/03
- [Qemu-stable] [PATCH 26/43] qcow2: Fix refcount table size calculation,
Michael Roth <=