]> git.baikalelectronics.ru Git - kernel.git/commit
can: peak_usb: fix a potential out-of-sync while decoding packets
authorStephane Grosjean <s.grosjean@peak-system.com>
Tue, 8 Oct 2019 08:35:44 +0000 (10:35 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 4 Nov 2019 20:47:20 +0000 (21:47 +0100)
commit2e7dadf070c86fb0297c0a0960486036dfe3a3c0
treebae51f20f837c6e9f37ffd8ba6082aab286fd139
parent6fd3a6242de94772c243b1b081504551d78dbe88
can: peak_usb: fix a potential out-of-sync while decoding packets

When decoding a buffer received from PCAN-USB, the first timestamp read in
a packet is a 16-bit coded time base, and the next ones are an 8-bit
offset to this base, regardless of the type of packet read.

This patch corrects a potential loss of synchronization by using a
timestamp index read from the buffer, rather than an index of received
data packets, to determine on the sizeof the timestamp to be read from the
packet being decoded.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Fixes: 44e5ddff0e54 ("can: usb: PEAK-System Technik PCAN-USB specific part")
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/peak_usb/pcan_usb.c