Blame SOURCES/kvm-block-iscsi-avoid-potential-overflow-of-acb-task-cdb.patch

607880
From f5596dffdad4014342239c7d3ec85e637969d2de Mon Sep 17 00:00:00 2001
607880
From: Fam Zheng <famz@redhat.com>
607880
Date: Fri, 29 Jul 2016 07:54:22 +0200
607880
Subject: [PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
607880
607880
RH-Author: Fam Zheng <famz@redhat.com>
607880
Message-id: <1469778862-32607-1-git-send-email-famz@redhat.com>
607880
Patchwork-id: 71515
607880
O-Subject: [RHEL-7.2.z qemu-kvm PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
607880
Bugzilla: 1358996
607880
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
607880
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
607880
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
607880
607880
From: Peter Lieven <pl@kamp.de>
607880
607880
at least in the path via virtio-blk the maximum size is not
607880
restricted.
607880
607880
Cc: qemu-stable@nongnu.org
607880
Signed-off-by: Peter Lieven <pl@kamp.de>
607880
Message-Id: <1464080368-29584-1-git-send-email-pl@kamp.de>
607880
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
607880
(cherry picked from commit a6b3167fa0e825aebb5a7cd8b437b6d41584a196)
607880
607880
 Conflicts:
607880
	block/iscsi.c
607880
607880
Upstream uses qemu_aio_unref, downstream uses qemu_aio_release.
607880
607880
Also, context in conflict because downstream doesn't have 4bb17ab51
607880
(iscsi: Emulate commands in iscsi_aio_ioctl as iscsi_ioctl).
607880
607880
Signed-off-by: Fam Zheng <famz@redhat.com>
607880
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
607880
---
607880
 block/iscsi.c | 7 +++++++
607880
 1 file changed, 7 insertions(+)
607880
607880
diff --git a/block/iscsi.c b/block/iscsi.c
607880
index 92dc1dd..d472ee8 100644
607880
--- a/block/iscsi.c
607880
+++ b/block/iscsi.c
607880
@@ -698,6 +698,13 @@ static BlockDriverAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
607880
     acb->buf         = NULL;
607880
     acb->ioh         = buf;
607880
 
607880
+    if (acb->ioh->cmd_len > SCSI_CDB_MAX_SIZE) {
607880
+        error_report("iSCSI: ioctl error CDB exceeds max size (%d > %d)",
607880
+                     acb->ioh->cmd_len, SCSI_CDB_MAX_SIZE);
607880
+        qemu_aio_release(acb);
607880
+        return NULL;
607880
+    }
607880
+
607880
     acb->task = malloc(sizeof(struct scsi_task));
607880
     if (acb->task == NULL) {
607880
         error_report("iSCSI: Failed to allocate task for scsi command. %s",
607880
-- 
607880
1.8.3.1
607880