[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PULL 06/43] block/iscsi: validate block size returned fro
From: |
Paolo Bonzini |
Subject: |
[Qemu-stable] [PULL 06/43] block/iscsi: validate block size returned from target |
Date: |
Wed, 9 Sep 2015 15:49:36 +0200 |
From: Peter Lieven <address@hidden>
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: address@hidden
Reported-by: Andrey Korolyov <address@hidden>
Signed-off-by: Peter Lieven <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/iscsi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/iscsi.c b/block/iscsi.c
index 5002916..93f1ee4 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);
--
2.4.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-stable] [PULL 06/43] block/iscsi: validate block size returned from target,
Paolo Bonzini <=