[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/17] hw: ehci: check return value of 'usb_packet_map'
From: |
Gerd Hoffmann |
Subject: |
[PULL 03/17] hw: ehci: check return value of 'usb_packet_map' |
Date: |
Wed, 19 Aug 2020 07:46:30 +0200 |
From: Li Qiang <liq3ea@163.com>
If 'usb_packet_map' fails, we should stop to process the usb
request.
Signed-off-by: Li Qiang <liq3ea@163.com>
Message-Id: <20200812161727.29412-1-liq3ea@163.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 58cceacbf83a..4da446d2de6b 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1373,7 +1373,10 @@ static int ehci_execute(EHCIPacket *p, const char
*action)
spd = (p->pid == USB_TOKEN_IN && NLPTR_TBIT(p->qtd.altnext) == 0);
usb_packet_setup(&p->packet, p->pid, ep, 0, p->qtdaddr, spd,
(p->qtd.token & QTD_TOKEN_IOC) != 0);
- usb_packet_map(&p->packet, &p->sgl);
+ if (usb_packet_map(&p->packet, &p->sgl)) {
+ qemu_sglist_destroy(&p->sgl);
+ return -1;
+ }
p->async = EHCI_ASYNC_INITIALIZED;
}
@@ -1453,7 +1456,10 @@ static int ehci_process_itd(EHCIState *ehci,
if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) {
usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false,
(itd->transact[i] & ITD_XACT_IOC) != 0);
- usb_packet_map(&ehci->ipacket, &ehci->isgl);
+ if (usb_packet_map(&ehci->ipacket, &ehci->isgl)) {
+ qemu_sglist_destroy(&ehci->isgl);
+ return -1;
+ }
usb_handle_packet(dev, &ehci->ipacket);
usb_packet_unmap(&ehci->ipacket, &ehci->isgl);
} else {
--
2.18.4
- [PULL 00/17] Usb 20200819 patches, Gerd Hoffmann, 2020/08/19
- [PULL 13/17] docs/system: Add U2F key to the USB devices examples, Gerd Hoffmann, 2020/08/19
- [PULL 02/17] hw: ehci: destroy sglist in error path, Gerd Hoffmann, 2020/08/19
- [PULL 03/17] hw: ehci: check return value of 'usb_packet_map',
Gerd Hoffmann <=
- [PULL 01/17] hw: xhci: check return value of 'usb_packet_map', Gerd Hoffmann, 2020/08/19
- [PULL 15/17] scripts: Add u2f-setup-gen script, Gerd Hoffmann, 2020/08/19
- [PULL 14/17] docs/qdev-device-use.txt: Add USB U2F key to the QDEV devices examples, Gerd Hoffmann, 2020/08/19
- [PULL 04/17] ehci: drop pointless warn_report for guest bugs., Gerd Hoffmann, 2020/08/19
- [PULL 05/17] hw/usb: Regroup USB HID protocol values, Gerd Hoffmann, 2020/08/19
- [PULL 17/17] hw/usb: Add U2F device autoscan to passthru mode, Gerd Hoffmann, 2020/08/19
- [PULL 07/17] hw/usb: Add U2F key base class, Gerd Hoffmann, 2020/08/19
- [PULL 06/17] docs: Add USB U2F key device documentation, Gerd Hoffmann, 2020/08/19
- [PULL 16/17] hw/usb: Add U2F device check to passthru mode, Gerd Hoffmann, 2020/08/19
- [PULL 12/17] configure: Add USB U2F key device, Gerd Hoffmann, 2020/08/19