diff options
| author | Peter Lieven <pl@kamp.de> | 2014-08-22 10:08:49 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-08-26 13:20:44 +0200 |
| commit | 9db693f76441e2fc7e1b05dc454e7db4d3298dcb (patch) | |
| tree | a4ef886f97f8169db3111f06d1d95165381ced32 | |
| parent | a818a4b69d47ca3826dee36878074395aeac2083 (diff) | |
| download | focaccia-qemu-9db693f76441e2fc7e1b05dc454e7db4d3298dcb.tar.gz focaccia-qemu-9db693f76441e2fc7e1b05dc454e7db4d3298dcb.zip | |
block/iscsi: fix memory corruption on iscsi resize
bs->total_sectors is not yet updated at this point. resulting in memory corruption if the volume has grown and data is written to the newly availble areas. CC: qemu-stable@nongnu.org Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | block/iscsi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/iscsi.c b/block/iscsi.c index 2c9cfc18eb..0bde13dc75 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1512,7 +1512,8 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset) if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = - bitmap_new(DIV_ROUND_UP(bs->total_sectors, + bitmap_new(DIV_ROUND_UP(sector_lun2qemu(iscsilun->num_blocks, + iscsilun), iscsilun->cluster_sectors)); } |