Skip to content

Commit

Permalink
block/iscsi: fix memory corruption on iscsi resize
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
plieven authored and bonzini committed Aug 26, 2014
1 parent a818a4b commit 9db693f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/iscsi.c
Expand Up @@ -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));
}

Expand Down

0 comments on commit 9db693f

Please sign in to comment.