Re: [PATCH] can: statistics: use atomic access in hot path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 10.03.25 16:04, Vincent Mailhol wrote:
On Mon. 10 Mar 2025 à 23:34, Oliver Hartkopp <socketcan@xxxxxxxxxxxx> wrote:
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@xxxxxxxxxxxxxxxxxxxxxxxxx

Maybe add a Fixes: tag?

I'm not sure about if we should provide a Fixes tag here.
The code is from the initial commit in 2008:

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/can/af_can.c?id=0d66548a10cbbe0ef256852d63d30603f0f73f9b

But it never created any problems and it is also not that relevant if we have a packet counter which is +/- 1 correct just to be displayed in the procfs for users that accidentally know about this feature.

If we add a Fixes tag the patch is backported to many stable kernels.
Not sure if it's worth it.

For future KCSAN tests we are safe then.

Best regards,
Oliver


Signed-off-by: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>

Notwithstanding of above remark:

Reviewed-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>


Yours sincerely,
Vincent Mailhol





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux