Skip to content

Commit fc75122

Browse files
Sebastian Andrzej SiewiorKalle Valo
authored andcommitted
libertas_tf: 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. I am removing the BUG_ON(!in_interrupt()); check because it serves no purpose. Running the completion callback in BH context makes in_interrupt() still return true but the interrupts could be enabled. The important part is that ->driver_lock is acquired with disabled interrupts which is the case now. Cc: Kalle Valo <kvalo@codeaurora.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: linux-wireless@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 3cade2f commit fc75122

File tree

1 file changed

+4
-4
lines changed
  • drivers/net/wireless/marvell/libertas_tf

1 file changed

+4
-4
lines changed

drivers/net/wireless/marvell/libertas_tf/if_usb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,21 +603,21 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
603603
struct if_usb_card *cardp,
604604
struct lbtf_private *priv)
605605
{
606+
unsigned long flags;
607+
606608
if (recvlength > LBS_CMD_BUFFER_SIZE) {
607609
lbtf_deb_usbd(&cardp->udev->dev,
608610
"The receive buffer is too large\n");
609611
kfree_skb(skb);
610612
return;
611613
}
612614

613-
BUG_ON(!in_interrupt());
614-
615-
spin_lock(&priv->driver_lock);
615+
spin_lock_irqsave(&priv->driver_lock, flags);
616616
memcpy(priv->cmd_resp_buff, recvbuff + MESSAGE_HEADER_LEN,
617617
recvlength - MESSAGE_HEADER_LEN);
618618
kfree_skb(skb);
619619
lbtf_cmd_response_rx(priv);
620-
spin_unlock(&priv->driver_lock);
620+
spin_unlock_irqrestore(&priv->driver_lock, flags);
621621
}
622622

623623
/**

0 commit comments

Comments
 (0)