mirror-linux/net/can
Vincent Mailhol c67732d067 can: annotate mtu accesses with READ_ONCE()
As hinted in commit 501a90c945 ("inet: protect against too small mtu
values."), net_device->mtu is vulnerable to race conditions if it is
written and read without holding the RTNL.

At the moment, all the writes are done while the interface is down,
either in the devices' probe() function or in can_changelink(). So
there are no such issues yet. But upcoming changes will allow to
modify the MTU while the CAN XL devices are up.

In preparation to the introduction of CAN XL, annotate all the
net_device->mtu accesses which are not yet guarded by the RTNL with a
READ_ONCE().

Note that all the write accesses are already either guarded by the
RTNL or are already annotated and thus need no changes.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Link: https://patch.msgid.link/20250923-can-fix-mtu-v3-1-581bde113f52@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2025-09-23 10:04:58 +02:00
..
j1939 can: j1939: j1939_local_ecu_get(): undo increment when j1939_local_ecu_get() fails 2025-09-10 17:12:05 +02:00
Kconfig can: isotp: remove ISO 15675-2 specification version where possible 2024-06-20 11:52:56 +02:00
Makefile
af_can.c can: annotate mtu accesses with READ_ONCE() 2025-09-23 10:04:58 +02:00
af_can.h can: statistics: use atomic access in hot path 2025-03-14 09:47:00 +01:00
bcm.c can: add drop reasons in CAN protocols receive path 2025-06-10 10:23:56 +02:00
gw.c can: gw: fix RCU/BH usage in cgw_create_job() 2025-05-06 15:55:36 +02:00
isotp.c can: annotate mtu accesses with READ_ONCE() 2025-09-23 10:04:58 +02:00
proc.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
raw.c can: annotate mtu accesses with READ_ONCE() 2025-09-23 10:04:58 +02:00