Blame SOURCES/kvm-usb-sanity-check-setup_index-setup_len-in-post_load.patch

958e1b
From 744a9df71d68005c83f01ddde142f1b08c8fc69c Mon Sep 17 00:00:00 2001
eb5a2f
From: Michael S. Tsirkin <mst@redhat.com>
958e1b
Date: Wed, 14 May 2014 08:35:57 +0200
958e1b
Subject: [PATCH 18/31] usb: sanity check setup_index+setup_len in post_load
eb5a2f
eb5a2f
RH-Author: Michael S. Tsirkin <mst@redhat.com>
958e1b
Message-id: <1400056525-6869-1-git-send-email-mst@redhat.com>
958e1b
Patchwork-id: 58864
958e1b
O-Subject: [PATCH qemu-kvm RHEL7.1 1/2] usb: sanity check setup_index+setup_len in post_load
958e1b
Bugzilla: 1095747
eb5a2f
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
eb5a2f
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
eb5a2f
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
eb5a2f
eb5a2f
From: Gerd Hoffmann <kraxel@redhat.com>
eb5a2f
eb5a2f
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
eb5a2f
(cherry picked from commit c60174e847082ab9f70720f86509a3353f816fad)
eb5a2f
958e1b
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7452039
eb5a2f
Tested: lightly on developer's box
eb5a2f
Bugzilla: 1095743
eb5a2f
---
eb5a2f
 hw/usb/bus.c | 4 ++++
eb5a2f
 1 file changed, 4 insertions(+)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 hw/usb/bus.c |    4 ++++
eb5a2f
 1 files changed, 4 insertions(+), 0 deletions(-)
eb5a2f
eb5a2f
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
eb5a2f
index fe6bd13..e0c3a77 100644
eb5a2f
--- a/hw/usb/bus.c
eb5a2f
+++ b/hw/usb/bus.c
eb5a2f
@@ -49,6 +49,10 @@ static int usb_device_post_load(void *opaque, int version_id)
eb5a2f
     } else {
eb5a2f
         dev->attached = 1;
eb5a2f
     }
eb5a2f
+    if (dev->setup_index >= sizeof(dev->data_buf) ||
eb5a2f
+        dev->setup_len >= sizeof(dev->data_buf)) {
eb5a2f
+        return -EINVAL;
eb5a2f
+    }
eb5a2f
     return 0;
eb5a2f
 }
eb5a2f
 
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f