summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/USB/VUSBUrb.cpp
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2022-02-28 18:28:04 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2022-02-28 18:28:04 +0000
commite26579d7f3da36df4b90492502ad81d0ab62d22c (patch)
tree857c8fb0cbe33f5ea0df2d1e9b0b7d92c50c7a41 /src/VBox/Devices/USB/VUSBUrb.cpp
parenta412934962f7e51abfe29bfa0bbc0189bf18c9e6 (diff)
downloadVirtualBox-svn-e26579d7f3da36df4b90492502ad81d0ab62d22c.tar.gz
Devices/USB: Fix crash introduced with r150219 when a USB device is detached while the roothub tries to queue an URB but can't find the device. Also cancel all in flight URBs after the device was removed from the lookup tables in order to prevent the roothub from queueing URBs simultaneously, bugref:10196
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@93993 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Devices/USB/VUSBUrb.cpp')
-rw-r--r--src/VBox/Devices/USB/VUSBUrb.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/VBox/Devices/USB/VUSBUrb.cpp b/src/VBox/Devices/USB/VUSBUrb.cpp
index eb7ccd916de..72e346c31cf 100644
--- a/src/VBox/Devices/USB/VUSBUrb.cpp
+++ b/src/VBox/Devices/USB/VUSBUrb.cpp
@@ -215,13 +215,12 @@ static void vusbMsgCompletion(PVUSBURB pUrb)
*
* @returns true if it could be retried.
* @returns false if it should be completed with failure.
+ * @param pRh The roothub the URB originated from.
* @param pUrb The URB in question.
*/
-int vusbUrbErrorRh(PVUSBURB pUrb)
+int vusbUrbErrorRhEx(PVUSBROOTHUB pRh, PVUSBURB pUrb)
{
PVUSBDEV pDev = pUrb->pVUsb->pDev;
- PVUSBROOTHUB pRh = vusbDevGetRh(pDev);
- AssertPtrReturn(pRh, VERR_VUSB_DEVICE_NOT_ATTACHED);
LogFlow(("%s: vusbUrbErrorRh: pDev=%p[%s] rh=%p\n", pUrb->pszDesc, pDev, pDev->pUsbIns ? pDev->pUsbIns->pszName : "", pRh));
return pRh->pIRhPort->pfnXferError(pRh->pIRhPort, pUrb);
}
@@ -229,9 +228,10 @@ int vusbUrbErrorRh(PVUSBURB pUrb)
/**
* Does URB completion on roothub level.
*
+ * @param pRh The roothub the URB originated from.
* @param pUrb The URB to complete.
*/
-void vusbUrbCompletionRh(PVUSBURB pUrb)
+void vusbUrbCompletionRhEx(PVUSBROOTHUB pRh, PVUSBURB pUrb)
{
LogFlow(("%s: vusbUrbCompletionRh: type=%s status=%s\n",
pUrb->pszDesc, vusbUrbTypeName(pUrb->enmType), vusbUrbStatusName(pUrb->enmStatus)));
@@ -249,9 +249,6 @@ void vusbUrbCompletionRh(PVUSBURB pUrb)
LogRel(("VUSB: Capturing URB completion event failed with %Rrc\n", rc));
}
- PVUSBROOTHUB pRh = vusbDevGetRh(pUrb->pVUsb->pDev);
- AssertPtrReturnVoid(pRh);
-
/* If there is a sniffer on the roothub record the completed URB there too. */
if (pRh->hSniffer != VUSBSNIFFER_NIL)
{
@@ -364,7 +361,7 @@ void vusbUrbCompletionRh(PVUSBURB pUrb)
#endif
case VUSBXFERTYPE_BULK:
if (pUrb->enmStatus != VUSBSTATUS_OK)
- vusbUrbErrorRh(pUrb);
+ vusbUrbErrorRhEx(pRh, pUrb);
break;
}
#ifdef LOG_ENABLED