Skip to content

Commit ed7aa30

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

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/net/usb/r8152.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@ static void read_bulk_callback(struct urb *urb)
12521252
int status = urb->status;
12531253
struct rx_agg *agg;
12541254
struct r8152 *tp;
1255+
unsigned long flags;
12551256

12561257
agg = urb->context;
12571258
if (!agg)
@@ -1281,9 +1282,9 @@ static void read_bulk_callback(struct urb *urb)
12811282
if (urb->actual_length < ETH_ZLEN)
12821283
break;
12831284

1284-
spin_lock(&tp->rx_lock);
1285+
spin_lock_irqsave(&tp->rx_lock, flags);
12851286
list_add_tail(&agg->list, &tp->rx_done);
1286-
spin_unlock(&tp->rx_lock);
1287+
spin_unlock_irqrestore(&tp->rx_lock, flags);
12871288
napi_schedule(&tp->napi);
12881289
return;
12891290
case -ESHUTDOWN:
@@ -1311,6 +1312,7 @@ static void write_bulk_callback(struct urb *urb)
13111312
struct net_device *netdev;
13121313
struct tx_agg *agg;
13131314
struct r8152 *tp;
1315+
unsigned long flags;
13141316
int status = urb->status;
13151317

13161318
agg = urb->context;
@@ -1332,9 +1334,9 @@ static void write_bulk_callback(struct urb *urb)
13321334
stats->tx_bytes += agg->skb_len;
13331335
}
13341336

1335-
spin_lock(&tp->tx_lock);
1337+
spin_lock_irqsave(&tp->tx_lock, flags);
13361338
list_add_tail(&agg->list, &tp->tx_free);
1337-
spin_unlock(&tp->tx_lock);
1339+
spin_unlock_irqrestore(&tp->tx_lock, flags);
13381340

13391341
usb_autopm_put_interface_async(tp->intf);
13401342

0 commit comments

Comments
 (0)