diff options
author | Peter Lieven <pl@kamp.de> | 2014-08-22 10:08:49 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-08-22 10:55:22 +0200 |
commit | d832fb4d66ead62da4af7e44cce34cd939e865e1 (patch) | |
tree | 7e7f3fe685c5bdce7217f75552e8e69049183368 /block/iscsi.c | |
parent | 13b552c2f43298a42e26d7aec7b58a5c205b75a0 (diff) | |
download | qemu-d832fb4d66ead62da4af7e44cce34cd939e865e1.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: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/iscsi.c')
-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 cdd19c2bda..3e19202488 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)); } |