Commit 77571f05 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: fix bug in usb_unlink_anchored_urbs()

Irqs must not accidentally be reenabled.
Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f8033827
...@@ -601,15 +601,20 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); ...@@ -601,15 +601,20 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);
void usb_unlink_anchored_urbs(struct usb_anchor *anchor) void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
{ {
struct urb *victim; struct urb *victim;
unsigned long flags;
spin_lock_irq(&anchor->lock); spin_lock_irqsave(&anchor->lock, flags);
while (!list_empty(&anchor->urb_list)) { while (!list_empty(&anchor->urb_list)) {
victim = list_entry(anchor->urb_list.prev, struct urb, victim = list_entry(anchor->urb_list.prev, struct urb,
anchor_list); anchor_list);
usb_get_urb(victim);
spin_unlock_irqrestore(&anchor->lock, flags);
/* this will unanchor the URB */ /* this will unanchor the URB */
usb_unlink_urb(victim); usb_unlink_urb(victim);
usb_put_urb(victim);
spin_lock_irqsave(&anchor->lock, flags);
} }
spin_unlock_irq(&anchor->lock); spin_unlock_irqrestore(&anchor->lock, flags);
} }
EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment