can: m_can: m_can_tx_handler(): fix use after free of skb
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 17 Mar 2022 07:57:35 +0000 (08:57 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 31 Mar 2022 07:55:27 +0000 (09:55 +0200)
commit2e8e79c416aae1de224c0f1860f2e3350fa171f8
treeabe2f008ba727f4eecbafa9b679069f3c8e3a172
parentfa7b514d2b2894e052b8e94c7a29feb98e90093f
can: m_can: m_can_tx_handler(): fix use after free of skb

can_put_echo_skb() will clone skb then free the skb. Move the
can_put_echo_skb() for the m_can version 3.0.x directly before the
start of the xmit in hardware, similar to the 3.1.x branch.

Fixes: 80646733f11c ("can: m_can: update to support CAN FD features")
Link: https://lore.kernel.org/all/20220317081305.739554-1-mkl@pengutronix.de
Cc: stable@vger.kernel.org
Reported-by: Hangyu Hua <hbh25y@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/m_can/m_can.c