This is a note to let you know that I've just added the patch titled can: mcp251xfd: mcp251xfd_register_get_dev_id(): use correct length to read dev_id to the 5.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: can-mcp251xfd-mcp251xfd_register_get_dev_id-use-correct-length-to-read-dev_id.patch and it can be found in the queue-5.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 0ff32bfa0e794ccc3601de7158b522bf736fa63c Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> Date: Thu, 16 Jun 2022 11:38:00 +0200 Subject: can: mcp251xfd: mcp251xfd_register_get_dev_id(): use correct length to read dev_id From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> commit 0ff32bfa0e794ccc3601de7158b522bf736fa63c upstream. The device ID register is 32 bits wide. The driver uses incorrectly the size of a pointer to a u32 to calculate the length of the SPI transfer. This results in a read of 2 registers on 64 bit platforms. This is no problem on the Linux side, as the RX buffer of the SPI transfer is large enough. In the mpc251xfd chip this results in the read of an undocumented register. So far no problems were observed. Fix the length of the SPI transfer to read the device ID register only. Link: https://lore.kernel.org/all/20220616094914.244440-1-mkl@xxxxxxxxxxxxxx Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN") Reported-by: Rasmus Villemoes <rasmus.villemoes@xxxxxxxxx> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -1769,7 +1769,7 @@ mcp251xfd_register_get_dev_id(const stru xfer[0].len = sizeof(buf_tx->cmd); xfer[0].speed_hz = priv->spi_max_speed_hz_slow; xfer[1].rx_buf = buf_rx->data; - xfer[1].len = sizeof(dev_id); + xfer[1].len = sizeof(*dev_id); xfer[1].speed_hz = priv->spi_max_speed_hz_fast; mcp251xfd_spi_cmd_read_nocrc(&buf_tx->cmd, MCP251XFD_REG_DEVID); Patches currently in stable-queue which might be from mkl@xxxxxxxxxxxxxx are queue-5.18/can-mcp251xfd-mcp251xfd_register_get_dev_id-fix-endianness-conversion.patch queue-5.18/can-rcar_canfd-fix-data-transmission-failed-on-r-car-v3u.patch queue-5.18/can-gs_usb-gs_usb_open-close-fix-memory-leak.patch queue-5.18/can-mcp251xfd-mcp251xfd_register_get_dev_id-use-correct-length-to-read-dev_id.patch queue-5.18/can-kvaser_usb-replace-run-time-checks-with-struct-kvaser_usb_driver_info.patch queue-5.18/can-mcp251xfd-mcp251xfd_regmap_crc_read-update-workaround-broken-crc-on-tbc-register.patch queue-5.18/can-kvaser_usb-kvaser_usb_leaf-fix-can-clock-frequency-regression.patch queue-5.18/can-kvaser_usb-kvaser_usb_leaf-fix-bittiming-limits.patch queue-5.18/can-mcp251xfd-mcp251xfd_stop-add-missing-hrtimer_cancel.patch queue-5.18/can-grcan-grcan_probe-remove-extra-of_node_get.patch queue-5.18/can-m_can-m_can_chip_config-actually-enable-internal-timestamping.patch queue-5.18/can-mcp251xfd-mcp251xfd_regmap_crc_read-improve-workaround-handling-for-mcp2517fd.patch queue-5.18/can-bcm-use-call_rcu-instead-of-costly-synchronize_rcu.patch queue-5.18/can-m_can-m_can_-read_fifo-echo_tx_event-shift-timestamp-to-full-32-bits.patch