diff options
| author | Eric Dumazet <edumazet@google.com> | 2025-01-15 01:10:49 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-01-16 02:07:23 +0300 |
| commit | 3440fa34ad99d471f1085bc2f4dedeaebc310261 (patch) | |
| tree | 3142948a327f9f064b98c840a24ab5774e8a7e82 /include/linux | |
| parent | bf38a2f766f8a4a7259d8b1debfe7ef082a3b2c9 (diff) | |
| download | linux-3440fa34ad99d471f1085bc2f4dedeaebc310261.tar.xz | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mroute_base.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h index 9dd4bf157255..58a2401e4b55 100644 --- a/include/linux/mroute_base.h +++ b/include/linux/mroute_base.h @@ -146,9 +146,9 @@ struct mr_mfc { unsigned long last_assert; int minvif; int maxvif; - unsigned long bytes; - unsigned long pkt; - unsigned long wrong_if; + atomic_long_t bytes; + atomic_long_t pkt; + atomic_long_t wrong_if; unsigned long lastuse; unsigned char ttls[MAXVIFS]; refcount_t refcount; |
