Skip to content

Commit 3a74eae

Browse files
committed
usb: hub: PDO: New checking in IsValidPDO()
As child's parent FDO at any moment can receive surprise removal, Before being it should notify it's childs by setting their parents to NULL. So if we see PDO with parent==NULL then we can consider it as physically removed, i.e. invalid. svn path=/branches/GSoC_2016/USB/; revision=72368
1 parent 262687e commit 3a74eae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/usbhub/pdo.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ IsValidPDO(
146146

147147
ChildDeviceExtension = (PHUB_CHILDDEVICE_EXTENSION)DeviceObject->DeviceExtension;
148148
ASSERT(ChildDeviceExtension->Common.IsFDO == FALSE);
149+
150+
// This can happen when parent device was surprise removed.
151+
if (ChildDeviceExtension->ParentDeviceObject == NULL)
152+
return FALSE;
153+
149154
HubDeviceExtension = (PHUB_DEVICE_EXTENSION)ChildDeviceExtension->ParentDeviceObject->DeviceExtension;
150155

151156
for(Index = 0; Index < USB_MAXCHILDREN; Index++)

0 commit comments

Comments
 (0)