[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/6] usb/hcd-xhci: check slotid in xhci_wakeup_endpoint()
From: |
Gerd Hoffmann |
Subject: |
[PULL 3/6] usb/hcd-xhci: check slotid in xhci_wakeup_endpoint() |
Date: |
Tue, 19 Jul 2022 17:22:15 +0200 |
From: Mauro Matteo Cascella <mcascell@redhat.com>
This prevents an OOB read (followed by an assertion failure in
xhci_kick_ep) when slotid > xhci->numslots.
Reported-by: Soul Chen <soulchen8650@gmail.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Message-Id: <20220705174734.2348829-1-mcascell@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 0cd0a5e54027..296cc6c8e694 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3269,7 +3269,8 @@ static void xhci_wakeup_endpoint(USBBus *bus, USBEndpoint
*ep,
DPRINTF("%s\n", __func__);
slotid = ep->dev->addr;
- if (slotid == 0 || !xhci->slots[slotid-1].enabled) {
+ if (slotid == 0 || slotid > xhci->numslots ||
+ !xhci->slots[slotid - 1].enabled) {
DPRINTF("%s: oops, no slot for dev %d\n", __func__, ep->dev->addr);
return;
}
--
2.36.1
- [PULL 0/6] Kraxel 20220719 patches, Gerd Hoffmann, 2022/07/19
- [PULL 1/6] dbus-display: fix test race when initializing p2p connection, Gerd Hoffmann, 2022/07/19
- [PULL 3/6] usb/hcd-xhci: check slotid in xhci_wakeup_endpoint(),
Gerd Hoffmann <=
- [PULL 2/6] microvm: turn off io reservations for pcie root ports, Gerd Hoffmann, 2022/07/19
- [PULL 4/6] usb: document guest-reset and guest-reset-all, Gerd Hoffmann, 2022/07/19
- [PULL 5/6] usb: document pcap (aka usb traffic capture), Gerd Hoffmann, 2022/07/19
- [PULL 6/6] gtk: Add show_tabs=on|off command line option., Gerd Hoffmann, 2022/07/19
- Re: [PULL 0/6] Kraxel 20220719 patches, Peter Maydell, 2022/07/19