linux/drivers/net/can
Vitor Soares d8fb63e46c can: mcp251xfd: fix infinite loop when xmit fails
When the mcp251xfd_start_xmit() function fails, the driver stops
processing messages, and the interrupt routine does not return,
running indefinitely even after killing the running application.

Error messages:
[  441.298819] mcp251xfd spi2.0 can0: ERROR in mcp251xfd_start_xmit: -16
[  441.306498] mcp251xfd spi2.0 can0: Transmit Event FIFO buffer not empty. (seq=0x000017c7, tef_tail=0x000017cf, tef_head=0x000017d0, tx_head=0x000017d3).
... and repeat forever.

The issue can be triggered when multiple devices share the same SPI
interface. And there is concurrent access to the bus.

The problem occurs because tx_ring->head increments even if
mcp251xfd_start_xmit() fails. Consequently, the driver skips one TX
package while still expecting a response in
mcp251xfd_handle_tefif_one().

Resolve the issue by starting a workqueue to write the tx obj
synchronously if err = -EBUSY. In case of another error, decrement
tx_ring->head, remove skb from the echo stack, and drop the message.

Fixes: 55e5b97f00 ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
Cc: stable@vger.kernel.org
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
Link: https://lore.kernel.org/all/20240517134355.770777-1-ivitro@gmail.com
[mkl: use more imperative wording in patch description]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2024-06-21 10:50:20 +02:00
..
c_can net: can: Use device_get_match_data() 2024-01-19 08:08:53 -06:00
cc770 net: handle HAS_IOPORT dependencies 2024-04-08 11:56:56 +01:00
ctucanfd can: ctucanfd: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
dev net: annotate writes on dev->mtu from ndo_change_mtu() 2024-05-07 16:19:14 -07:00
esd can: esd: add support for esd GmbH PCIe/402 CAN interface family 2024-02-12 16:58:30 +01:00
flexcan net: can: Use device_get_match_data() 2024-01-19 08:08:53 -06:00
ifi_canfd can: Explicitly include correct DT includes, part 2 2023-07-28 08:49:52 +02:00
m_can can: tcan4x5x: support resuming from rx interrupt signal 2024-02-14 13:44:02 +01:00
mscan net: can: Use device_get_match_data() 2024-01-19 08:08:53 -06:00
peak_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
rcar can: Explicitly include correct DT includes, part 2 2023-07-28 08:49:52 +02:00
sja1000 net: handle HAS_IOPORT dependencies 2024-04-08 11:56:56 +01:00
slcan tty: use u8 for flags 2023-08-11 21:12:45 +02:00
softing can: softing: remove redundant NULL check 2024-02-12 17:25:42 +01:00
spi can: mcp251xfd: fix infinite loop when xmit fails 2024-06-21 10:50:20 +02:00
usb can: kvaser_usb: fix return value for hif_usb_send_regout 2024-06-21 10:50:20 +02:00
Kconfig can: kvaser_pciefd: Add support for Kvaser PCIe 8xCAN 2024-03-04 08:38:34 +01:00
Makefile can: esd: add support for esd GmbH PCIe/402 CAN interface family 2024-02-12 16:58:30 +01:00
at91_can.c can: at91_can: switch to rx-offload implementation 2023-10-05 21:47:45 +02:00
bxcan.c can: Explicitly include correct DT includes, part 2 2023-07-28 08:49:52 +02:00
can327.c tty: use u8 for flags 2023-08-11 21:12:45 +02:00
grcan.c can: Explicitly include correct DT includes 2023-07-19 08:55:28 +02:00
janz-ican3.c can: janz-ican3: Convert to platform remove callback returning void 2023-05-15 22:53:50 +02:00
kvaser_pciefd.c can: kvaser_pciefd: Add additional Xilinx interrupts 2024-03-19 15:26:01 +01:00
sun4i_can.c can: Explicitly include correct DT includes, part 2 2023-07-28 08:49:52 +02:00
ti_hecc.c can: rx-offload: rename rx_offload_get_echo_skb() -> can_rx_offload_get_echo_skb_queue_timestamp() 2023-07-28 09:45:24 +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: Add ethtool stats interface for ECC errors 2024-02-16 14:18:31 +01:00