can: dev: __can_get_echo_skb(): fix real payload length return value for RTR frames
authorOliver Hartkopp <socketcan@hartkopp.net>
Tue, 20 Oct 2020 06:44:43 +0000 (08:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:18:42 +0000 (19:18 +0100)
commit7a63a403d3fae2726e062d81fe6d15417529b25c
treed1688f915b5008537de8861c915a7ce7a9c7773d
parent7e4cf2ec0ca236c3e5f904239cec6efe1f3baf22
can: dev: __can_get_echo_skb(): fix real payload length return value for RTR frames

[ Upstream commit ed3320cec279407a86bc4c72edc4a39eb49165ec ]

The can_get_echo_skb() function returns the number of received bytes to
be used for netdev statistics. In the case of RTR frames we get a valid
(potential non-zero) data length value which has to be passed for further
operations. But on the wire RTR frames have no payload length. Therefore
the value to be used in the statistics has to be zero for RTR frames.

Reported-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20201020064443.80164-1-socketcan@hartkopp.net
Fixes: cf5046b309b3 ("can: dev: let can_get_echo_skb() return dlc of CAN frame")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/dev.c