linux/drivers/net/can
Anssi Hannula 725b33deeb can: xilinx_can: xcan_write_frame(): fix use-after-free of transmitted SKB
[ Upstream commit ef79f00be7 ]

can_put_echo_skb() takes ownership of the SKB and it may be freed
during or after the call.

However, xilinx_can xcan_write_frame() keeps using SKB after the call.

Fix that by only calling can_put_echo_skb() after the code is done
touching the SKB.

The tx_lock is held for the entire xcan_write_frame() execution and
also on the can_get_echo_skb() side so the order of operations does not
matter.

An earlier fix commit 3d3c817c3a ("can: xilinx_can: Fix usage of skb
memory") did not move the can_put_echo_skb() call far enough.

Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Fixes: 1598efe57b ("can: xilinx_can: refactor code in preparation for CAN FD support")
Link: https://patch.msgid.link/20250822095002.168389-1-anssi.hannula@bitwise.fi
[mkl: add "commit" in front of sha1 in patch description]
[mkl: fix indention]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-09-19 16:35:49 +02:00
..
c_can can: c_can: Use of_property_present() to test existence of DT property 2025-05-29 11:02:45 +02:00
cc770 can: {cc770,sja1000}_isa: allow building on x86_64 2024-11-04 17:46:06 +01:00
ctucanfd can: ctucanfd: handle skb allocation failure 2025-02-21 14:01:33 +01:00
dev can: netlink: can_changelink(): fix NULL pointer deref of struct can_priv::do_set_mode 2025-08-01 09:48:41 +01:00
esd can: esd_402_pci: Add support for one-shot mode 2024-08-05 17:32:00 +02:00
flexcan can: flexcan: add NXP S32G2/S32G3 SoC support 2025-04-20 10:15:18 +02:00
ifi_canfd can: ifi_canfd: ifi_canfd_handle_lec_err(): fix {rx,tx}_errors statistics 2024-12-14 20:03:01 +01:00
m_can can: tcan4x5x: fix reset gpio usage during probe 2025-07-24 08:56:31 +02:00
mscan can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
peak_canfd can: peak_canfd: Remove setting of RX software timestamp 2024-09-03 15:17:47 -07:00
rcar can: rcar_canfd: Fix page entries in the AFL list 2025-03-28 22:03:28 +01:00
rockchip can: rockchip_canfd: rkcanfd_remove(): fix order of unregistration calls 2025-05-18 08:24:47 +02:00
sja1000 can: sja1000: sja1000_err(): fix {rx,tx}_errors statistics 2024-12-14 20:03:02 +01:00
slcan can: slcan: allow reception of short error messages 2025-05-29 11:03:19 +02:00
softing can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
spi can: mcp251xfd: fix TDC setting for low data bit rates 2025-05-18 08:24:48 +02:00
usb can: kvaser_usb: Assign netdev.dev_port based on device channel index 2025-08-15 12:13:47 +02:00
at91_can.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
bxcan.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
can327.c tty: use u8 for flags 2023-08-11 21:12:45 +02:00
grcan.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
janz-ican3.c can: Switch back to struct platform_driver::remove() 2024-09-11 09:37:16 +02:00
Kconfig can: rockchip_canfd: add driver for Rockchip CAN-FD controller 2024-09-04 14:41:51 +02:00
kvaser_pciefd.c can: kvaser_pciefd: Store device channel index 2025-08-15 12:13:47 +02:00
Makefile can: rockchip_canfd: add driver for Rockchip CAN-FD controller 2024-09-04 14:41:51 +02:00
sun4i_can.c can: sun4i_can: sun4i_can_err(): fix {rx,tx}_errors statistics 2024-12-14 20:03:02 +01:00
ti_hecc.c Revert "can: ti_hecc: fix -Woverflow compiler warning" 2025-08-28 16:31:05 +02:00
vcan.c net: annotate writes on dev->mtu from ndo_change_mtu() 2024-05-07 16:19:14 -07:00
vxcan.c net: annotate writes on dev->mtu from ndo_change_mtu() 2024-05-07 16:19:14 -07:00
xilinx_can.c can: xilinx_can: xcan_write_frame(): fix use-after-free of transmitted SKB 2025-09-19 16:35:49 +02:00