]> asedeno.scripts.mit.edu Git - linux.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)
commitde280f403f2996679e2607384980703710576fed
treebae51f20f837c6e9f37ffd8ba6082aab286fd139
parent5e269324db5adb2f5f6ec9a93a9c7b0672932b47
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: 46be265d3388 ("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