yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

34b321
From d2291657a3d6100be53008fe8206c9e72b37c584 Mon Sep 17 00:00:00 2001
607880
From: Fam Zheng <famz@redhat.com>
34b321
Date: Wed, 22 Jun 2016 01:06:15 +0200
607880
Subject: [PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
607880
607880
RH-Author: Fam Zheng <famz@redhat.com>
34b321
Message-id: <20160622010615.10307-1-famz@redhat.com>
34b321
Patchwork-id: 70730
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
34b321
Bugzilla: 1340929
34b321
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
607880
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
34b321
RH-Acked-by: Stefan Hajnoczi <stefanha@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