|
|
eb5a2f |
From f01e8ceed912ea31bf22046197fd18b82e554e48 Mon Sep 17 00:00:00 2001
|
|
|
eb5a2f |
From: Michael S. Tsirkin <mst@redhat.com>
|
|
|
eb5a2f |
Date: Thu, 15 May 2014 09:52:52 +0200
|
|
|
eb5a2f |
Subject: [PATCH 16/30] usb: fix up post load checks
|
|
|
eb5a2f |
|
|
|
eb5a2f |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
eb5a2f |
Message-id: <1400144747-16304-1-git-send-email-mst@redhat.com>
|
|
|
eb5a2f |
Patchwork-id: 58906
|
|
|
eb5a2f |
O-Subject: [PATCH qemu-kvm RHEL7.0.z] usb: fix up post load checks
|
|
|
eb5a2f |
Bugzilla: 1096828
|
|
|
eb5a2f |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
eb5a2f |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
eb5a2f |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
eb5a2f |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
eb5a2f |
|
|
|
eb5a2f |
Correct post load checks:
|
|
|
eb5a2f |
1. dev->setup_len == sizeof(dev->data_buf)
|
|
|
eb5a2f |
seems fine, no need to fail migration
|
|
|
eb5a2f |
2. When state is DATA, passing index > len
|
|
|
eb5a2f |
will cause memcpy with negative length,
|
|
|
eb5a2f |
resulting in heap overflow
|
|
|
eb5a2f |
|
|
|
eb5a2f |
First of the issues was reported by dgilbert.
|
|
|
eb5a2f |
|
|
|
eb5a2f |
Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
eb5a2f |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
eb5a2f |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
eb5a2f |
(cherry picked from commit 719ffe1f5f72b1c7ace4afe9ba2815bcb53a829e)
|
|
|
eb5a2f |
Note: in maintainer's tree
|
|
|
eb5a2f |
git://github.com/juanquintela/qemu.git tags/migration/20140515,
|
|
|
eb5a2f |
pull request sent
|
|
|
eb5a2f |
|
|
|
eb5a2f |
CVE-2014-3461
|
|
|
eb5a2f |
|
|
|
eb5a2f |
Bugzilla: 1096828
|
|
|
eb5a2f |
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7459773
|
|
|
eb5a2f |
Tested: lightly on developer's box
|
|
|
eb5a2f |
---
|
|
|
eb5a2f |
hw/usb/bus.c | 4 ++--
|
|
|
eb5a2f |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
eb5a2f |
|
|
|
eb5a2f |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
eb5a2f |
---
|
|
|
eb5a2f |
hw/usb/bus.c | 4 ++--
|
|
|
eb5a2f |
1 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
eb5a2f |
|
|
|
eb5a2f |
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
|
|
|
eb5a2f |
index 9766b7f..f4eeb5e 100644
|
|
|
eb5a2f |
--- a/hw/usb/bus.c
|
|
|
eb5a2f |
+++ b/hw/usb/bus.c
|
|
|
eb5a2f |
@@ -51,8 +51,8 @@ static int usb_device_post_load(void *opaque, int version_id)
|
|
|
eb5a2f |
}
|
|
|
eb5a2f |
if (dev->setup_index < 0 ||
|
|
|
eb5a2f |
dev->setup_len < 0 ||
|
|
|
eb5a2f |
- dev->setup_index >= sizeof(dev->data_buf) ||
|
|
|
eb5a2f |
- dev->setup_len >= sizeof(dev->data_buf)) {
|
|
|
eb5a2f |
+ dev->setup_index > dev->setup_len ||
|
|
|
eb5a2f |
+ dev->setup_len > sizeof(dev->data_buf)) {
|
|
|
eb5a2f |
return -EINVAL;
|
|
|
eb5a2f |
}
|
|
|
eb5a2f |
return 0;
|
|
|
eb5a2f |
--
|
|
|
eb5a2f |
1.7.1
|
|
|
eb5a2f |
|