diff options
author | Stephane Grosjean <s.grosjean@peak-system.com> | 2018-03-08 09:30:28 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2018-03-12 09:55:12 +0100 |
commit | e6048a00cfd0863d32f53b226e0b9a3633fc3332 (patch) | |
tree | b1a3a7837b56623def8cea734a01b321572f4c5f /drivers/net/can/peak_canfd/peak_pciefd_main.c | |
parent | 880dd464b4304583c557c4e5f5ecebfd55d232b1 (diff) | |
download | linux-e6048a00cfd0863d32f53b226e0b9a3633fc3332.tar.bz2 |
can: peak/pcie_fd: fix echo_skb is occupied! bug
This patch makes atomic the handling of the linux-can echo_skb array and
the network tx queue. This prevents from the "BUG! echo_skb is occupied!"
message to be printed by the linux-can core, in SMP environments.
Reported-by: Diana Burgess <diana@peloton-tech.com>
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/peak_canfd/peak_pciefd_main.c')
-rw-r--r-- | drivers/net/can/peak_canfd/peak_pciefd_main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c index 788c3464a3b0..3c51a884db87 100644 --- a/drivers/net/can/peak_canfd/peak_pciefd_main.c +++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c @@ -349,8 +349,12 @@ static irqreturn_t pciefd_irq_handler(int irq, void *arg) priv->tx_pages_free++; spin_unlock_irqrestore(&priv->tx_lock, flags); - /* wake producer up */ - netif_wake_queue(priv->ucan.ndev); + /* wake producer up (only if enough room in echo_skb array) */ + spin_lock_irqsave(&priv->ucan.echo_lock, flags); + if (!priv->ucan.can.echo_skb[priv->ucan.echo_idx]) + netif_wake_queue(priv->ucan.ndev); + + spin_unlock_irqrestore(&priv->ucan.echo_lock, flags); } /* re-enable Rx DMA transfer for this CAN */ |