diff --git a/drivers/usb/xhcid/src/xhci/irq_reactor.rs b/drivers/usb/xhcid/src/xhci/irq_reactor.rs index c89efd04d8..ee3fe5aaf3 100644 --- a/drivers/usb/xhcid/src/xhci/irq_reactor.rs +++ b/drivers/usb/xhcid/src/xhci/irq_reactor.rs @@ -459,6 +459,9 @@ impl IrqReactor { }; // TODO: Validate the command TRB. + // Release the event TRB before waking the future so a + // re-entrant waker.wake() cannot re-match this TRB. + trb.reserved(false); state.finish(Some(NextEventTrb { src_trb: Some(command_trb.clone()), event_trb: trb.clone(), @@ -489,6 +492,7 @@ impl IrqReactor { let src_trb = self.hci.get_transfer_trb(phys_ptr, ring_id); // Give the source transfer TRB together with the event TRB, to the future. let state = self.states.remove(index); + trb.reserved(false); state.finish(Some(NextEventTrb { src_trb: src_trb, event_trb: trb.clone(), @@ -518,6 +522,7 @@ impl IrqReactor { if self.hci.with_ring(ring_id, |_ring| ()).is_none() { log::debug!("State {} is a dead transfer", index); let state = self.states.remove(index); + trb.reserved(false); state.finish(Some(NextEventTrb { src_trb: None, //TODO: don't send this TRB as it may not be related @@ -529,6 +534,7 @@ impl IrqReactor { StateKind::Other(trb_type) if trb_type as u8 == trb.trb_type() => { let state = self.states.remove(index); + trb.reserved(false); state.finish(None); return; } @@ -557,6 +563,7 @@ impl IrqReactor { continue; } let state = self.states.remove(index); + trb.reserved(false); state.finish(Some(NextEventTrb { event_trb: trb.clone(), src_trb: None,