]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 18 Jun 2021 09:07:21 +0000 (11:07 +0200)
commitd99df84d53c057aca558e745b6c940bb9b7e8484
tree288f76d7919aa3128fdbe4471c54e0aaf217e970
parent10a9c4378d8869e7b4636f4d1417f84a2b44d85e
can: m_can: m_can_tx_work_queue(): fix tx_skb race condition

BugLink: https://bugs.launchpad.net/bugs/1931292
[ Upstream commit e04b2cfe61072c7966e1a5fb73dd1feb30c206ed ]

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: f524f829b75a ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/can/m_can/m_can.c