From: Kevin Wolf Date: Thu, 23 Jan 2020 17:00:54 +0000 (+0100) Subject: iscsi: Don't access non-existent scsi_lba_status_descriptor X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5fbf1d56c24018772e900a40a0955175ff82f35c;p=qemu.git iscsi: Don't access non-existent scsi_lba_status_descriptor In iscsi_co_block_status(), we may have received num_descriptors == 0 from the iscsi server. Therefore, we can't unconditionally access lbas->descriptors[0]. Add the missing check. Signed-off-by: Kevin Wolf Reviewed-by: Felipe Franciosi Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: John Snow Reviewed-by: Peter Lieven --- diff --git a/block/iscsi.c b/block/iscsi.c index cbd57294ab..c8feaa2f0e 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -753,7 +753,7 @@ retry: } lbas = scsi_datain_unmarshall(iTask.task); - if (lbas == NULL) { + if (lbas == NULL || lbas->num_descriptors == 0) { ret = -EIO; goto out_unlock; }