Skip to content

Commit ba49fed

Browse files
Sebastian Andrzej Siewiordavem330
authored andcommitted
net: usb: kaweth: 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 12c4de4 commit ba49fed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/usb/kaweth.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static void kaweth_usb_receive(struct urb *urb)
587587
struct kaweth_device *kaweth = urb->context;
588588
struct net_device *net = kaweth->net;
589589
int status = urb->status;
590-
590+
unsigned long flags;
591591
int count = urb->actual_length;
592592
int count2 = urb->transfer_buffer_length;
593593

@@ -619,12 +619,12 @@ static void kaweth_usb_receive(struct urb *urb)
619619
net->stats.rx_errors++;
620620
dev_dbg(dev, "Status was -EOVERFLOW.\n");
621621
}
622-
spin_lock(&kaweth->device_lock);
622+
spin_lock_irqsave(&kaweth->device_lock, flags);
623623
if (IS_BLOCKED(kaweth->status)) {
624-
spin_unlock(&kaweth->device_lock);
624+
spin_unlock_irqrestore(&kaweth->device_lock, flags);
625625
return;
626626
}
627-
spin_unlock(&kaweth->device_lock);
627+
spin_unlock_irqrestore(&kaweth->device_lock, flags);
628628

629629
if(status && status != -EREMOTEIO && count != 1) {
630630
dev_err(&kaweth->intf->dev,

0 commit comments

Comments
 (0)