[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 37/97] usbredir: fix buffer-overflow on vmload
From: |
Michael Roth |
Subject: |
[PATCH 37/97] usbredir: fix buffer-overflow on vmload |
Date: |
Tue, 1 Oct 2019 18:45:16 -0500 |
From: Marc-André Lureau <address@hidden>
If interface_count is NO_INTERFACE_INFO, let's not access the arrays
out-of-bounds.
==994==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000243930
at pc 0x5642068086a8 bp 0x7f0b6f9ffa50 sp 0x7f0b6f9ffa40
READ of size 1 at 0x625000243930 thread T0
#0 0x5642068086a7 in usbredir_check_bulk_receiving
/home/elmarco/src/qemu/hw/usb/redirect.c:1503
#1 0x56420681301c in usbredir_post_load
/home/elmarco/src/qemu/hw/usb/redirect.c:2154
#2 0x5642068a56c2 in vmstate_load_state
/home/elmarco/src/qemu/migration/vmstate.c:168
#3 0x56420688e2ac in vmstate_load
/home/elmarco/src/qemu/migration/savevm.c:829
#4 0x5642068980cb in qemu_loadvm_section_start_full
/home/elmarco/src/qemu/migration/savevm.c:2211
#5 0x564206899645 in qemu_loadvm_state_main
/home/elmarco/src/qemu/migration/savevm.c:2395
#6 0x5642068998cf in qemu_loadvm_state
/home/elmarco/src/qemu/migration/savevm.c:2467
#7 0x56420685f3e9 in process_incoming_migration_co
/home/elmarco/src/qemu/migration/migration.c:449
#8 0x564207106c47 in coroutine_trampoline
/home/elmarco/src/qemu/util/coroutine-ucontext.c:115
#9 0x7f0c0604e37f (/lib64/libc.so.6+0x4d37f)
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Liam Merwick <address@hidden>
Reviewed-by: Li Qiang <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
(cherry picked from commit 7b84b90966568da0e05655ecaa78c209300aae6e)
Signed-off-by: Michael Roth <address@hidden>
---
hw/usb/redirect.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 7cb6b120d4..586c7db025 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1494,6 +1494,11 @@ static void usbredir_check_bulk_receiving(USBRedirDevice
*dev)
for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
dev->endpoint[i].bulk_receiving_enabled = 0;
}
+
+ if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
+ return;
+ }
+
for (i = 0; i < dev->interface_info.interface_count; i++) {
quirks = usb_get_quirks(dev->device_info.vendor_id,
dev->device_info.product_id,
--
2.17.1
- [PATCH 01/97] qcow2: Avoid COW during metadata preallocation, (continued)
- [PATCH 01/97] qcow2: Avoid COW during metadata preallocation, Michael Roth, 2019/10/01
- [PATCH 30/97] target/ppc: Fix lxvw4x, lxvh8x and lxvb16x, Michael Roth, 2019/10/01
- [PATCH 13/97] block/file-posix: Unaligned O_DIRECT block-status, Michael Roth, 2019/10/01
- [PATCH 29/97] target/ppc: Fix vsum2sws, Michael Roth, 2019/10/01
- [PATCH 34/97] target/i386: define md-clear bit, Michael Roth, 2019/10/01
- [PATCH 14/97] iotests: Test unaligned raw images with O_DIRECT, Michael Roth, 2019/10/01
- [PATCH 20/97] QEMUMachine: add events_wait method, Michael Roth, 2019/10/01
- [PATCH 33/97] target/i386: add MDS-NO feature, Michael Roth, 2019/10/01
- [PATCH 25/97] vhost: fix vhost_log size overflow during migration, Michael Roth, 2019/10/01
- [PATCH 02/97] qcow2: Add errp to preallocate_co(), Michael Roth, 2019/10/01
- [PATCH 37/97] usbredir: fix buffer-overflow on vmload,
Michael Roth <=
- [PATCH 40/97] sphinx: add qmp_lexer, Michael Roth, 2019/10/01
- [PATCH 31/97] q35: Revert to kernel irqchip, Michael Roth, 2019/10/01
- [PATCH 27/97] target/ppc: Fix xvxsigdp, Michael Roth, 2019/10/01
- [PATCH 26/97] target/ppc: Fix xvabs[sd]p, xvnabs[sd]p, xvneg[sd]p, xvcpsgn[sd]p, Michael Roth, 2019/10/01
- [PATCH 46/97] i386/acpi: show PCI Express bus on pxb-pcie expanders, Michael Roth, 2019/10/01
- [PATCH 56/97] tpm: Exit in reset when backend indicates failure, Michael Roth, 2019/10/01
- [PATCH 35/97] docs: recommend use of md-clear feature on all Intel CPUs, Michael Roth, 2019/10/01
- [PATCH 38/97] virtio-balloon: fix QEMU 4.0 config size migration incompatibility, Michael Roth, 2019/10/01
- [PATCH 49/97] virtio-balloon: Simplify deflate with pbp, Michael Roth, 2019/10/01
- [PATCH 44/97] hw/ssi/xilinx_spips: Avoid out-of-bound access to lqspi_buf[], Michael Roth, 2019/10/01