[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/7] uhci: Don't allow the guest to set port-enabled
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 2/7] uhci: Don't allow the guest to set port-enabled when there is no dev connected |
Date: |
Wed, 21 Nov 2012 14:59:59 +0100 |
From: Hans de Goede <address@hidden>
It is possible for device disconnect and the guest trying to reset the port
(because of USB xact errors prior to the disconnect getting signaled) to race,
when we hit this race, the guest will write the port-control register with its
pre-disconnect value + the reset bit set, after which we have a disconnected
device with its port-enabled bit set in its port-control register, which
is no good :)
Signed-off-by: Hans de Goede <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-uhci.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index ef32633..078be2a 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -556,6 +556,10 @@ static void uhci_ioport_writew(void *opaque, uint32_t
addr, uint32_t val)
}
}
port->ctrl &= UHCI_PORT_READ_ONLY;
+ /* enabled may only be set if a device is connected */
+ if (!(port->ctrl & UHCI_PORT_CCS)) {
+ val &= ~UHCI_PORT_EN;
+ }
port->ctrl |= (val & ~UHCI_PORT_READ_ONLY);
/* some bits are reset when a '1' is written to them */
port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR);
--
1.7.1
- [Qemu-devel] [PULL for-1.3 0/7] usb patch queue, Gerd Hoffmann, 2012/11/21
- [Qemu-devel] [PATCH 2/7] uhci: Don't allow the guest to set port-enabled when there is no dev connected,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 7/7] usb-redir: Don't handle interrupt output packets async, Gerd Hoffmann, 2012/11/21
- [Qemu-devel] [PATCH 6/7] usb-redir: Split usb_handle_interrupt_data into separate in/out functions, Gerd Hoffmann, 2012/11/21
- [Qemu-devel] [PATCH 5/7] usb-smartcard-reader: Properly NAK interrupt eps when we've no events, Gerd Hoffmann, 2012/11/21
- [Qemu-devel] [PATCH 1/7] uhci: Add a completions_only flag for async completions, Gerd Hoffmann, 2012/11/21
- [Qemu-devel] [PATCH 4/7] usb-bt: Return NAK instead of STALL when interrupt ep has no data, Gerd Hoffmann, 2012/11/21
- [Qemu-devel] [PATCH 3/7] uhci: Fix double unlink, Gerd Hoffmann, 2012/11/21
- Re: [Qemu-devel] [PULL for-1.3 0/7] usb patch queue, Anthony Liguori, 2012/11/26