diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-09-19 09:53:45 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-09-23 13:55:00 +0200 |
commit | 29a8c9ec9090b335ece3bd58d779af7f569b5a65 (patch) | |
tree | 59bdbfa6cc6071cfd7ace27a16119ec977094404 /drivers/net/can/Makefile | |
parent | can: gs_usb: gs_usb_get_timestamp(): fix endpoint parameter for usb_control_msg_recv() (diff) | |
download | linux-dev-29a8c9ec9090b335ece3bd58d779af7f569b5a65.tar.xz linux-dev-29a8c9ec9090b335ece3bd58d779af7f569b5a65.zip |
can: gs_usb: add missing lock to protect struct timecounter::cycle_last
The struct timecounter::cycle_last is a 64 bit variable, read by
timecounter_cyc2time(), and written by timecounter_read(). On 32 bit
architectures this is not atomic.
Add a spinlock to protect access to struct timecounter::cycle_last. In
the gs_usb_timestamp_read() callback the lock is dropped to execute a
sleeping synchronous USB transfer. This is safe, as the variable we
want to protect is accessed during this call.
Fixes: 45dfa45f52e6 ("can: gs_usb: add RX and TX hardware timestamp support")
Link: https://lore.kernel.org/all/20220920100416.959226-3-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>
Diffstat (limited to 'drivers/net/can/Makefile')
0 files changed, 0 insertions, 0 deletions