Skip to contentSkip to conversation

Avoid possible NULL dereference in XHCI driver

PATCH New Jim Posen 1 participant 1 message Oct 25, 2021

Subsystems (2)
lore
Share & tools
lore

Jim Posen

author
#0 lore raw

PATCH 1/1 Avoid possible NULL dereference in XHCI driver

In the recovery function abort_td run after timed out XHCI transfers, there's a possible NULL pointer dereference. Instead, explicitly BUG_ON that condition.

---

 drivers/usb/host/xhci-ring.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-ring.c +1 -0
index 35bd5cd29e..1635d03ece 100644
@@ -499,6 +499,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
 	xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_STOP_RING);
 
 	event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
+	BUG_ON(!event);
 	field = le32_to_cpu(event->trans_event.flags);
 	BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
 	BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
Signature · 1 line
2.25.1