linux/net/can
Oliver Hartkopp 80b5f90158 can: statistics: use atomic access in hot path
In can_send() and can_receive() CAN messages and CAN filter matches are
counted to be visible in the CAN procfs files.

KCSAN detected a data race within can_send() when two CAN frames have
been generated by a timer event writing to the same CAN netdevice at the
same time. Use atomic operations to access the statistics in the hot path
to fix the KCSAN complaint.

Reported-by: syzbot+78ce4489b812515d5e4d@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/67cd717d.050a0220.e1a89.0006.GAE@google.com
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20250310143353.3242-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2025-03-14 09:47:00 +01:00
..
j1939 can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero 2025-02-08 11:28:57 +01:00
Kconfig can: isotp: remove ISO 15675-2 specification version where possible 2024-06-20 11:52:56 +02:00
Makefile can: add ISO 15765-2:2016 transport protocol 2020-10-07 23:18:33 +02:00
af_can.c can: statistics: use atomic access in hot path 2025-03-14 09:47:00 +01:00
af_can.h can: statistics: use atomic access in hot path 2025-03-14 09:47:00 +01:00
bcm.c can: bcm: Clear bo->bcm_proc_read after remove_proc_entry(). 2024-09-12 09:40:08 +02:00
gw.c can: gw: Use rtnl_register_many(). 2024-10-15 18:52:26 -07:00
isotp.c can: isotp: remove ISO 15675-2 specification version where possible 2024-06-20 11:52:56 +02:00
proc.c can: statistics: use atomic access in hot path 2025-03-14 09:47:00 +01:00
raw.c sock: support SO_PRIORITY cmsg 2024-12-16 18:13:44 -08:00