]> git.baikalelectronics.ru Git - kernel.git/commit
can: gs_usb: gs_can_open(): initialize time counter before starting device
authorMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 20 Sep 2022 09:46:12 +0000 (11:46 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 23 Sep 2022 11:55:00 +0000 (13:55 +0200)
commit3891dafd292ae15136b8a40c35f9dee6da9ff949
treee9446035f1290b9e5d61d69ba88ae82a6eed60ad
parentfe4f61b524aed496a2f7dc2ca99a8bd06913fe03
can: gs_usb: gs_can_open(): initialize time counter before starting device

On busy networks the CAN controller might receive CAN frames directly
after starting it but before the timecounter is setup. This will lead
to NULL pointer deref while converting the converting the CAN frame's
timestamp with the timecounter.

Close the race window by setting up the timecounter before starting
the CAN controller.

Fixes: c351fac8f5e8 ("can: gs_usb: add RX and TX hardware timestamp support")
Link: https://lore.kernel.org/all/20220921081329.385509-1-mkl@pengutronix.de
Cc: John Whittington <git@jbrengineering.co.uk
Tested-by: John Whittington <git@jbrengineering.co.uk>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/gs_usb.c