block/iscsi: fix memory corruption on iscsi resize
PATCH 1/1 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.
Signed-off-by Peter Lieven <[email protected]>
--- block/iscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/iscsi.c +2 -1
@@ -1509,7 +1509,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)); }
Signature · 1 line
1.7.9.5
Kevin Wolf
AppliedAm 22.08.2014 um 10:08 hat Peter Lieven geschrieben:
Quoted 6 lines
bs->total_sectorsis not yet updated at this point. resulting in memory corruption if the volume has grown and data is written to the newly availble areas.Signed-off-by Peter Lieven <[email protected]>
Thanks, applied to the block branch.
Kevin