]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 18:40:33 +0000 (20:40 +0200)
commitd93ed9aff64968f4cdad690712eb4f48ae537bde
tree37f7a7fb3243a496c59177f99196b9a6fdda2041
parente3a3bfdbb4b23e140c178c8e61ef68d66803ea2b
can: m_can: m_can_tx_handler(): fix use after free of skb

commit 2e8e79c416aae1de224c0f1860f2e3350fa171f8 upstream.

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>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/can/m_can/m_can.c