Commit 871ecf03 authored by Oliver Hartkopp's avatar Oliver Hartkopp Committed by Carlos Llamas
Browse files

UPSTREAM: can: statistics: use atomic access in hot path



[ Upstream commit 80b5f901 ]

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: default avatar <syzbot+78ce4489b812515d5e4d@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/all/67cd717d.050a0220.e1a89.0006.GAE@google.com


Change-Id: Ia1b2b44418970aad7fff7472ad1f805a9c0bf096
Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Reviewed-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20250310143353.3242-1-socketcan@hartkopp.net


Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit d840c84c)
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 50817926
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment