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