Blame 0021-block-iscsi-avoid-potential-overflow-of-acb-task-cdb.patch

cf91b1
From: Peter Lieven <pl@kamp.de>
cf91b1
Date: Tue, 24 May 2016 10:59:28 +0200
cf91b1
Subject: [PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
cf91b1
cf91b1
at least in the path via virtio-blk the maximum size is not
cf91b1
restricted.
cf91b1
cf91b1
Cc: qemu-stable@nongnu.org
cf91b1
Signed-off-by: Peter Lieven <pl@kamp.de>
cf91b1
Message-Id: <1464080368-29584-1-git-send-email-pl@kamp.de>
cf91b1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cf91b1
(cherry picked from commit a6b3167fa0e825aebb5a7cd8b437b6d41584a196)
cf91b1
---
cf91b1
 block/iscsi.c | 7 +++++++
cf91b1
 1 file changed, 7 insertions(+)
cf91b1
cf91b1
diff --git a/block/iscsi.c b/block/iscsi.c
cf91b1
index 302baf8..172e6cf 100644
cf91b1
--- a/block/iscsi.c
cf91b1
+++ b/block/iscsi.c
cf91b1
@@ -837,6 +837,13 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
cf91b1
         return &acb->common;
cf91b1
     }
cf91b1
 
cf91b1
+    if (acb->ioh->cmd_len > SCSI_CDB_MAX_SIZE) {
cf91b1
+        error_report("iSCSI: ioctl error CDB exceeds max size (%d > %d)",
cf91b1
+                     acb->ioh->cmd_len, SCSI_CDB_MAX_SIZE);
cf91b1
+        qemu_aio_unref(acb);
cf91b1
+        return NULL;
cf91b1
+    }
cf91b1
+
cf91b1
     acb->task = malloc(sizeof(struct scsi_task));
cf91b1
     if (acb->task == NULL) {
cf91b1
         error_report("iSCSI: Failed to allocate task for scsi command. %s",