aboutsummaryrefslogtreecommitdiff
path: root/block/iscsi.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2020-01-23 18:00:54 +0100
committerKevin Wolf <kwolf@redhat.com>2020-01-27 17:19:53 +0100
commit5fbf1d56c24018772e900a40a0955175ff82f35c (patch)
treea59a377c3ba9f1e319e2b4417d09adac850f6397 /block/iscsi.c
parent693fd2acdf14dd86c0bf852610f1c2cca80a74dc (diff)
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 <kwolf@redhat.com> Reviewed-by: Felipe Franciosi <felipe@nutanix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de>
Diffstat (limited to 'block/iscsi.c')
-rw-r--r--block/iscsi.c2
1 files changed, 1 insertions, 1 deletions
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;
}