Skip to content

Commit fafa6b1

Browse files
Sebastian Andrzej Siewiordavem330
authored andcommitted
net: usb: cdc-phonet: use irqsave() in USB's complete callback
The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f79e711 commit fafa6b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/usb/cdc-phonet.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static void tx_complete(struct urb *req)
9999
struct net_device *dev = skb->dev;
100100
struct usbpn_dev *pnd = netdev_priv(dev);
101101
int status = req->status;
102+
unsigned long flags;
102103

103104
switch (status) {
104105
case 0:
@@ -115,10 +116,10 @@ static void tx_complete(struct urb *req)
115116
}
116117
dev->stats.tx_packets++;
117118

118-
spin_lock(&pnd->tx_lock);
119+
spin_lock_irqsave(&pnd->tx_lock, flags);
119120
pnd->tx_queue--;
120121
netif_wake_queue(dev);
121-
spin_unlock(&pnd->tx_lock);
122+
spin_unlock_irqrestore(&pnd->tx_lock, flags);
122123

123124
dev_kfree_skb_any(skb);
124125
usb_free_urb(req);

0 commit comments

Comments
 (0)