]> git.baikalelectronics.ru Git - kernel.git/commit
can: do not copy the payload of RTR frames
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Tue, 7 Dec 2021 12:15:29 +0000 (21:15 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 5 Jan 2022 11:09:05 +0000 (12:09 +0100)
commit89c8843b49338ae9258d36b5f07f9550b9b343a4
tree8e23e66fe02c46e03d8d16411fd768294da8766e
parent6bc96c547ba5537ac6590bbf00478a4d78a50fd6
can: do not copy the payload of RTR frames

The actual payload length of the CAN Remote Transmission Request (RTR)
frames is always 0, i.e. no payload is transmitted on the wire.
However, those RTR frames still use the DLC to indicate the length of
the requested frame.

For this reason, it is incorrect to copy the payload of RTR frames
(the payload buffer would only contain garbage data). This patch
encapsulates the payload copy in a check toward the RTR flag.

Link: https://lore.kernel.org/all/20211207121531.42941-4-mailhol.vincent@wanadoo.fr
Cc: Yasushi SHOJI <yashi@spacecubics.com>
Tested-by: Yasushi SHOJI <yashi@spacecubics.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/pch_can.c
drivers/net/can/spi/mcp251x.c
drivers/net/can/usb/mcba_usb.c