]> git.baikalelectronics.ru Git - kernel.git/commit
can: m_can: m_can_tx_work_queue(): fix tx_skb race condition
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 5 May 2021 11:32:27 +0000 (13:32 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 6 May 2021 07:24:07 +0000 (09:24 +0200)
commit3fb0e79fdd6ae3b319f89ca300d12ba2a8440eeb
tree75e4c665edffabc8bd7631af5dfbf797f4d3a580
parentf7c23901b0db867f9c7d5fd54d21934bf58b6aeb
can: m_can: m_can_tx_work_queue(): fix tx_skb race condition

The m_can_start_xmit() function checks if the cdev->tx_skb is NULL and
returns with NETDEV_TX_BUSY in case tx_sbk is not NULL.

There is a race condition in the m_can_tx_work_queue(), where first
the skb is send to the driver and then the case tx_sbk is set to NULL.
A TX complete IRQ might come in between and wake the queue, which
results in tx_skb not being cleared yet.

Fixes: 15c73136c866 ("can: m_can: Create a m_can platform framework")
Tested-by: Torin Cooper-Bennun <torin@maxiluxsystems.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/m_can.c