Skip to content

Commit 91785de

Browse files
Stephane Grosjeanmarckleinebudde
authored andcommitted
can: peak/pcie_fd: fix potential bug in restarting tx queue
Don't rely on can_get_echo_skb() return value to wake the network tx queue up: can_get_echo_skb() returns 0 if the echo array slot was not occupied, but also when the DLC of the released echo frame was 0. Signed-off-by: Stephane Grosjean <[email protected]> Cc: linux-stable <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 12147ed commit 91785de

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/net/can/peak_canfd/peak_canfd.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,18 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
258258
/* if this frame is an echo, */
259259
if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
260260
!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
261-
int n;
262261
unsigned long flags;
263262

264263
spin_lock_irqsave(&priv->echo_lock, flags);
265-
n = can_get_echo_skb(priv->ndev, msg->client);
264+
can_get_echo_skb(priv->ndev, msg->client);
266265
spin_unlock_irqrestore(&priv->echo_lock, flags);
267266

268267
/* count bytes of the echo instead of skb */
269268
stats->tx_bytes += cf_len;
270269
stats->tx_packets++;
271270

272-
if (n) {
273-
/* restart tx queue only if a slot is free */
274-
netif_wake_queue(priv->ndev);
275-
}
271+
/* restart tx queue (a slot is free) */
272+
netif_wake_queue(priv->ndev);
276273

277274
return 0;
278275
}

0 commit comments

Comments
 (0)