diff options
author | Peter Lieven <pl@kamp.de> | 2015-08-14 13:33:36 +0200 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2015-10-17 18:14:37 -0500 |
commit | 2ac9fa162e25019eaa548f1fadfee256af88ca0f (patch) | |
tree | b2387961d986ff31f99114518c65aec15dcfa457 /block | |
parent | 5b7d840e741aa06751b0fcec02ccda50a6bd574d (diff) | |
download | qemu-2ac9fa162e25019eaa548f1fadfee256af88ca0f.tar.gz qemu-2ac9fa162e25019eaa548f1fadfee256af88ca0f.tar.bz2 qemu-2ac9fa162e25019eaa548f1fadfee256af88ca0f.zip |
block/iscsi: validate block size returned from target
It has been reported that at least tgtd returns a block size of 0
for LUN 0. To avoid running into divide by zero later on and protect
against other problematic block sizes validate the block size right
at connection time.
Cc: qemu-stable@nongnu.org
Reported-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Peter Lieven <pl@kamp.de>
Message-Id: <1439552016-8557-1-git-send-email-pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 6d1f252d8c1ba73bf6ed9af28731a9c9c3d473a2)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/iscsi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/block/iscsi.c b/block/iscsi.c index 50029168eb..93f1ee4c63 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1214,6 +1214,10 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) if (task == NULL || task->status != SCSI_STATUS_GOOD) { error_setg(errp, "iSCSI: failed to send readcapacity10 command."); + } else if (!iscsilun->block_size || + iscsilun->block_size % BDRV_SECTOR_SIZE) { + error_setg(errp, "iSCSI: the target returned an invalid " + "block size of %d.", iscsilun->block_size); } if (task) { scsi_free_scsi_task(task); |