]> www.infradead.org Git - users/hch/misc.git/commit
inet: ipmr: fix data-races
authorEric Dumazet <edumazet@google.com>
Tue, 14 Jan 2025 22:10:49 +0000 (22:10 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 15 Jan 2025 23:07:23 +0000 (15:07 -0800)
commit3440fa34ad99d471f1085bc2f4dedeaebc310261
tree3142948a327f9f064b98c840a24ab5774e8a7e82
parentbf38a2f766f8a4a7259d8b1debfe7ef082a3b2c9
inet: ipmr: fix data-races

Following fields of 'struct mr_mfc' can be updated
concurrently (no lock protection) from ip_mr_forward()
and ip6_mr_forward()

- bytes
- pkt
- wrong_if
- lastuse

They also can be read from other functions.

Convert bytes, pkt and wrong_if to atomic_long_t,
and use READ_ONCE()/WRITE_ONCE() for lastuse.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20250114221049.1190631-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
include/linux/mroute_base.h
net/ipv4/ipmr.c
net/ipv4/ipmr_base.c
net/ipv6/ip6mr.c