From 21d554cc1392cdf41cc360f89ca7c80af7a647a1 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Mon, 29 Mar 2004 16:55:44 -0800 Subject: [PATCH] [PATCH] USB: ohci unlink tweaks Minor unlink tweaks, including a case where SMP could oops if it were abused, as if from 'usbtest' or 'stir4200'. --- drivers/usb/host/ohci-hcd.c | 2 +- drivers/usb/host/ohci-q.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 1d9a689b06bba..44144a55308fa 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -233,7 +233,7 @@ static int ohci_urb_enqueue ( spin_lock (&urb->lock); if (urb->status != -EINPROGRESS) { spin_unlock (&urb->lock); - + urb->hcpriv = urb_priv; finish_urb (ohci, urb, 0); retval = 0; goto fail; diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index b5f5f1f899b03..99b156ded8219 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c @@ -1073,10 +1073,12 @@ dl_done_list (struct ohci_hcd *ohci, struct td *td, struct pt_regs *regs) finish_urb (ohci, urb, regs); /* clean schedule: unlink EDs that are no longer busy */ - if (list_empty (&ed->td_list) && ed->state == ED_OPER) - start_ed_unlink (ohci, ed); + if (list_empty (&ed->td_list)) { + if (ed->state == ED_OPER) + start_ed_unlink (ohci, ed); + /* ... reenabling halted EDs only after fault cleanup */ - else if ((ed->hwINFO & (ED_SKIP | ED_DEQUEUE)) == ED_SKIP) { + } else if ((ed->hwINFO & (ED_SKIP | ED_DEQUEUE)) == ED_SKIP) { td = list_entry (ed->td_list.next, struct td, td_list); if (!(td->hwINFO & TD_DONE)) { ed->hwINFO &= ~ED_SKIP; -- 2.53.0