can: j1939: transport: j1939_xtp_rx_dat_one(): compare own packets to detect corruptions
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 7 Aug 2020 10:52:00 +0000 (12:52 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 14 Aug 2020 10:38:47 +0000 (12:38 +0200)
commite052d0540298bfe0f6cbbecdc7e2ea9b859575b2
treee433a91b95c486e4c8b7e6c4a738e67fa8f3bd0c
parent840835c9281215341d84966a8855f267a971e6a3
can: j1939: transport: j1939_xtp_rx_dat_one(): compare own packets to detect corruptions

Since the stack relays on receiving own packets, it was overwriting own
transmit buffer from received packets.

At least theoretically, the received echo buffer can be corrupt or
changed and the session partner can request to resend previous data. In
this case we will re-send bad data.

With this patch we will stop to overwrite own TX buffer and use it for
sanity checking.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20200807105200.26441-6-o.rempel@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/j1939/transport.c