diff options
author | Sebastian Siewior <bigeasy@linutronix.de> | 2012-03-07 05:19:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-08 03:49:29 -0500 |
commit | 4231d47e6fe69f061f96c98c30eaf9fb4c14b96d (patch) | |
tree | bdb4f840384af48728128657d90402747cfd142d /drivers | |
parent | ac3f48de09d8f4b73397047e413fadff7f65cfa7 (diff) |
net/usbnet: avoid recursive locking in usbnet_stop()
|kernel BUG at kernel/rtmutex.c:724!
|[<c029599c>] (rt_spin_lock_slowlock+0x108/0x2bc) from [<c01c2330>] (defer_bh+0x1c/0xb4)
|[<c01c2330>] (defer_bh+0x1c/0xb4) from [<c01c3afc>] (rx_complete+0x14c/0x194)
|[<c01c3afc>] (rx_complete+0x14c/0x194) from [<c01cac88>] (usb_hcd_giveback_urb+0xa0/0xf0)
|[<c01cac88>] (usb_hcd_giveback_urb+0xa0/0xf0) from [<c01e1ff4>] (musb_giveback+0x34/0x40)
|[<c01e1ff4>] (musb_giveback+0x34/0x40) from [<c01e2b1c>] (musb_advance_schedule+0xb4/0x1c0)
|[<c01e2b1c>] (musb_advance_schedule+0xb4/0x1c0) from [<c01e2ca8>] (musb_cleanup_urb.isra.9+0x80/0x8c)
|[<c01e2ca8>] (musb_cleanup_urb.isra.9+0x80/0x8c) from [<c01e2ed0>] (musb_urb_dequeue+0xec/0x108)
|[<c01e2ed0>] (musb_urb_dequeue+0xec/0x108) from [<c01cbb90>] (unlink1+0xbc/0xcc)
|[<c01cbb90>] (unlink1+0xbc/0xcc) from [<c01cc2ec>] (usb_hcd_unlink_urb+0x54/0xa8)
|[<c01cc2ec>] (usb_hcd_unlink_urb+0x54/0xa8) from [<c01c2a84>] (unlink_urbs.isra.17+0x2c/0x58)
|[<c01c2a84>] (unlink_urbs.isra.17+0x2c/0x58) from [<c01c2b44>] (usbnet_terminate_urbs+0x94/0x10c)
|[<c01c2b44>] (usbnet_terminate_urbs+0x94/0x10c) from [<c01c2d68>] (usbnet_stop+0x100/0x15c)
|[<c01c2d68>] (usbnet_stop+0x100/0x15c) from [<c020f718>] (__dev_close_many+0x94/0xc8)
defer_bh() takes the lock which is hold during unlink_urbs(). The safe
walk suggest that the skb will be removed from the list and this is done
by defer_bh() so it seems to be okay to drop the lock here.
Cc: stable@kernel.org
Reported-by: AnÃbal Almeida Pinto <anibal.pinto@efacec.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/usbnet.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index fae0fbd8bc88..81b96e303757 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -589,6 +589,7 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) | |||
589 | entry = (struct skb_data *) skb->cb; | 589 | entry = (struct skb_data *) skb->cb; |
590 | urb = entry->urb; | 590 | urb = entry->urb; |
591 | 591 | ||
592 | spin_unlock_irqrestore(&q->lock, flags); | ||
592 | // during some PM-driven resume scenarios, | 593 | // during some PM-driven resume scenarios, |
593 | // these (async) unlinks complete immediately | 594 | // these (async) unlinks complete immediately |
594 | retval = usb_unlink_urb (urb); | 595 | retval = usb_unlink_urb (urb); |
@@ -596,6 +597,7 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) | |||
596 | netdev_dbg(dev->net, "unlink urb err, %d\n", retval); | 597 | netdev_dbg(dev->net, "unlink urb err, %d\n", retval); |
597 | else | 598 | else |
598 | count++; | 599 | count++; |
600 | spin_lock_irqsave(&q->lock, flags); | ||
599 | } | 601 | } |
600 | spin_unlock_irqrestore (&q->lock, flags); | 602 | spin_unlock_irqrestore (&q->lock, flags); |
601 | return count; | 603 | return count; |