B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: sw@simonwunderlich.de
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	b.a.t.m.a.n@lists.open-mesh.org, sven@narfation.org
Subject: Re: [PATCH net-next 07/15] batman-adv: tt: don't remove unhashed local entries
Date: Tue, 24 Nov 2026 17:20:41 +0000	[thread overview]
Message-ID: <179554084147.3135.8288154830036400852@kernel.org> (raw)
In-Reply-To: <20261123171827.3294525-8-sw@simonwunderlich.de>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit "batman-adv: tt: don't remove unhashed local entries"
  fixes two real races in the local translation table but has no Fixes:…

--

batman-adv: tt: don't remove unhashed local entries

This patch merges batadv_tt_local_mark_removed() and
batadv_tt_local_remove_now() into batadv_tt_local_remove_entry(). The
hashed check, the BATADV_TT_CLIENT_NEW check and the unhash now all run
under the bucket list_lock and the flags_lock of the entry. This closes a
race with batadv_tt_local_purge_pending_clients() and a second race with
batadv_tt_local_transition_new().

> batadv_tt_local_remove() looks up the local entry via RCU only.
> batadv_tt_local_purge_pending_clients() can unhash it before
> batadv_tt_local_mark_removed() acquired the hash bucket list_lock. The DEL
> is then queued for a client which is no longer part of the local table (and
> its CRC). And it might replace the queued ADD of a new entry which was
> added for the same client in the meantime.

[ ... ]

> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/bug/linux-c3e34735-5286-4ed0-9338-a77e64fef540
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>

[Severity: Low]
This isn't a bug, but should this commit have a Fixes: tag?

The commit message describes two races that already exist in the tree:

  - batadv_tt_local_mark_removed() queues a DEL without checking whether
    batadv_tt_local_purge_pending_clients() has unhashed the entry after
    the RCU lookup in batadv_tt_local_remove().

  - batadv_tt_local_mark_removed() checks BATADV_TT_CLIENT_NEW under the
    bucket list_lock, but batadv_tt_local_remove_now() unhashes the entry
    via batadv_hash_remove() only after that lock has been dropped.

Two earlier fixes to the same functions both carry a Fixes: tag:

  f95b9f28a9df ("batman-adv: tt: queue local DEL event under bucket lock")
  a6746cb19076 ("batman-adv: tt: queue local DEL event before marking
                 entry as pending")

Both of them use:

  Fixes: 976b159b3c12 ("batman-adv: tt: use protected flag modifications")

batadv_tt_local_remove_now(), which this patch removes, was added by
931de98d3960 ("batman-adv: tt: extract immediate purge of a local entry").

The missing hashed check in the first race was already there before
f95b9f28a9df. Its origin may therefore be a different commit than the one
behind the second race.

Without a Fixes: tag, backporters and the stable tooling cannot tell which
trees contain the broken logic. If leaving out the tag is intentional for
a net-next submission, as with the other fixes later in this series, please
disregard this.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123171827.3294525-2-sw%40simonwunderlich.de

  reply	other threads:[~2026-11-24 17:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:18 [PATCH net-next 00/15] pull request for net-next: batman-adv 2026-11-23 Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 01/15] batman-adv: document refcount of returned objects Simon Wunderlich
2026-11-23 17:23   ` netdev-bot+sinfo
2026-11-23 18:13     ` Sven Eckelmann
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-23 17:18 ` [PATCH net-next 02/15] batman-adv: mcast: use mla_lock also during mcast_free Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 03/15] batman-adv: mark functions inheriting critical sections Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 04/15] batman-adv: bla: register own backbone gw when claiming for local node Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-24 19:19     ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 05/15] batman-adv: tt: unhash local entries with hlist_del_init_rcu() Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 06/15] batman-adv: tt: refresh local entry in single flags_lock section Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-24 19:22     ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 07/15] batman-adv: tt: don't remove unhashed local entries Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko [this message]
2026-11-24 19:24     ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 08/15] batman-adv: tt: don't queue local events for unhashed entries Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 09/15] batman-adv: tt: remove unannounced local entries via pending state Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 10/15] batman-adv: tt: keep local entry unchanged when ADD can't be queued Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-24 19:30     ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 11/15] batman-adv: tt: requeue DEL of pending local entry after failed allocation Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-24 19:46     ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 12/15] batman-adv: tt: extract removal of pending local entry Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-24 20:16     ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 13/15] batman-adv: tt: commit only the announced local changes Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko
2026-11-23 17:18 ` [PATCH net-next 14/15] batman-adv: tt: avoid list_lock for unchanged local clients Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 15/15] batman-adv: tt: drop ADD+DEL events of never announced clients Simon Wunderlich
2026-11-24 17:20   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179554084147.3135.8288154830036400852@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sven@narfation.org \
    --cc=sw@simonwunderlich.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox