[PATCH batadv v2 0/7] batman-adv: replace non-atomic fields with (READ|WRITE)_ONCE

Sven Eckelmann <[email protected]>
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
Many fields in the batman-adv datastructures are only accessed as plain
loads/stores and do not require full atomic_t semantics. Convert these
fields to native integer types and replace their users with
READ_ONCE()/WRITE_ONCE() to avoid load/store tearing.

This was noticed while searching for other atomic_t code which
(incorrectly) does things like:

    if (atomic_read(foo)) {
        do_important_mutual_exlusive_thing();
        atomic_set(foo, x);
    }

Signed-off-by: Sven Eckelmann <[email protected]>
---
Changes in v2:
- rebase
- Link to v1: https://patch.msgid.link/[email protected]

---
Sven Eckelmann (7):
      batman-adv: replace non-atomic meshif config fields with (READ|WRITE)_ONCE
      batman-adv: replace non-atomic hardif config fields with (READ|WRITE)_ONCE
      batman-adv: replace non-atomic vlan config fields with (READ|WRITE)_ONCE
      batman-adv: replace non-atomic mesh state with (READ|WRITE)_ONCE
      batman-adv: replace non-atomic packet_size_max with (READ|WRITE)_ONCE
      batman-adv: replace non-atomic last_ttvn with (READ|WRITE)_ONCE
      batman-adv: replace non-atomic last_acked with (READ|WRITE)_ONCE

 net/batman-adv/bat_iv_ogm.c            | 28 +++++++------
 net/batman-adv/bat_v.c                 | 10 ++---
 net/batman-adv/bat_v_elp.c             |  9 ++--
 net/batman-adv/bat_v_ogm.c             | 13 +++---
 net/batman-adv/bridge_loop_avoidance.c | 14 +++----
 net/batman-adv/distributed-arp-table.c | 16 +++----
 net/batman-adv/gateway_client.c        |  6 +--
 net/batman-adv/gateway_common.c        | 14 +++----
 net/batman-adv/hard-interface.c        | 15 ++++---
 net/batman-adv/log.h                   |  2 +-
 net/batman-adv/main.c                  | 22 +++++-----
 net/batman-adv/mesh-interface.c        | 38 ++++++++---------
 net/batman-adv/multicast.c             |  4 +-
 net/batman-adv/netlink.c               | 77 +++++++++++++++++-----------------
 net/batman-adv/originator.c            |  3 +-
 net/batman-adv/routing.c               |  6 +--
 net/batman-adv/send.c                  |  6 +--
 net/batman-adv/tp_meter.c              | 28 ++++++-------
 net/batman-adv/translation-table.c     | 24 +++++------
 net/batman-adv/types.h                 | 68 +++++++++++++++---------------
 20 files changed, 204 insertions(+), 199 deletions(-)
---
base-commit: ff182fc0c666754e3f35f7b63c9ccf0dff239e52
change-id: 20260512-atomic-to-write-once-9801e8d6b58e

Best regards,
--  
Sven Eckelmann <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.