[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 23/24] usb: sanity check setup_index+setup_len in
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PATCH v5 23/24] usb: sanity check setup_index+setup_len in post_load |
Date: |
Thu, 3 Apr 2014 19:52:25 +0300 |
CVE-2013-4541
s->setup_len and s->setup_index are fed into usb_packet_copy as
size/offset into s->data_buf, it's possible for invalid state to exploit
this to load arbitrary data.
setup_len and setup_index should be checked to make sure
they are not negative.
Cc: Gerd Hoffmann <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/usb/bus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index fe70429..e48b19f 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -49,7 +49,9 @@ static int usb_device_post_load(void *opaque, int version_id)
} else {
dev->attached = 1;
}
- if (dev->setup_index >= sizeof(dev->data_buf) ||
+ if (dev->setup_index < 0 ||
+ dev->setup_len < 0 ||
+ dev->setup_index >= sizeof(dev->data_buf) ||
dev->setup_len >= sizeof(dev->data_buf)) {
return -EINVAL;
}
--
MST
- Re: [Qemu-devel] [PATCH v5 17/24] ssi-sd: fix buffer overrun on invalid state load, (continued)
- [Qemu-devel] [PATCH v5 18/24] ssd0323: fix buffer overun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 19/24] tsc210x: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 21/24] virtio-scsi: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 20/24] zaurus: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 22/24] vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 06/24] virtio-net: out-of-bounds buffer write on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 23/24] usb: sanity check setup_index+setup_len in post_load,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH v5 24/24] savevm: Ignore minimum_version_id_old if there is no load_state_old, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 07/24] virtio: out-of-bounds buffer write on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 05/24] virtio-net: out-of-bounds buffer write on load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 04/24] virtio-net: fix buffer overflow on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-devel] [PATCH v5 03/24] vmstate: add VMSTATE_VALIDATE, Michael S. Tsirkin, 2014/04/03
- Message not available