qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/iscsi: validate block size returned from target
@ 2015-08-14 11:33 Peter Lieven
  2015-08-31  8:38 ` Peter Lieven
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Lieven @ 2015-08-14 11:33 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: pbonzini, andrey, Peter Lieven, qemu-stable, ronniesahlberg

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>
---
 block/iscsi.c | 4 ++++
 dtc           | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 5002916..fac3a7a 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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] block/iscsi: validate block size returned from target
  2015-08-14 11:33 [Qemu-devel] [PATCH] block/iscsi: validate block size returned from target Peter Lieven
@ 2015-08-31  8:38 ` Peter Lieven
  2015-09-07 10:39   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Lieven @ 2015-08-31  8:38 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: pbonzini, andrey, qemu-stable, ronniesahlberg

Am 14.08.2015 um 13:33 schrieb Peter Lieven:
> 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>
> ---
>   block/iscsi.c | 4 ++++
>   dtc           | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 5002916..fac3a7a 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);

Ping

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] block/iscsi: validate block size returned from target
  2015-08-31  8:38 ` Peter Lieven
@ 2015-09-07 10:39   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-09-07 10:39 UTC (permalink / raw)
  To: Peter Lieven, qemu-devel, qemu-block; +Cc: andrey, qemu-stable, ronniesahlberg



On 31/08/2015 10:38, Peter Lieven wrote:
>>
>> diff --git a/block/iscsi.c b/block/iscsi.c
>> index 5002916..fac3a7a 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);
> 
> Ping

Queued but not sent due to KVM Forum and vacation.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-07 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-14 11:33 [Qemu-devel] [PATCH] block/iscsi: validate block size returned from target Peter Lieven
2015-08-31  8:38 ` Peter Lieven
2015-09-07 10:39   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).