Netdev List
 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 10/15] batman-adv: tt: keep local entry unchanged when ADD can't be queued
Date: Tue, 24 Nov 2026 17:20:43 +0000	[thread overview]
Message-ID: <179554084314.3135.7493792255015362398@kernel.org> (raw)
In-Reply-To: <20261123171827.3294525-11-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] Resolved later in the series.

--

batman-adv: tt: keep local entry unchanged when ADD can't be queued

This patch makes __batadv_tt_local_event() return whether the change was
stored. Callers that queue an ADD now modify the local entry only after
the ADD was queued: batadv_tt_local_refresh_locked() for flag updates and
batadv_tt_local_insert() for hashing a new entry. A failed refresh is
passed back up to batadv_tt_local_add().

> diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> index 977f62c88da76..c94b292a1c4a8 100644
> --- a/net/batman-adv/translation-table.c
> +++ b/net/batman-adv/translation-table.c
> @@ -653,10 +653,18 @@ static u16 batadv_tt_flags_get(struct batadv_tt_common_entry *common)
>   * Only a single change per client is queued. It describes the latest state of
>   * the client and a new event therefore replaces an already queued one.
>   *
> + * The other nodes only learn about the modification of a local entry through
> + * the queued change. The caller must therefore not modify the entry in a way
> + * which depends on this change (e.g. hash it as BATADV_TT_CLIENT_NEW or mark it
> + * as BATADV_TT_CLIENT_PENDING) when the event could not be stored.
> + *
>   * The caller must hold the flags_lock of @common. The events of an entry are
>   * then queued in the same order in which its flags were modified.
> + *
> + * Return: true if the event was stored, false if the memory for it could not
> + * be allocated.
>   */
> -static void __batadv_tt_local_event(struct batadv_priv *bat_priv,
> +static bool __batadv_tt_local_event(struct batadv_priv *bat_priv,
>  				    const struct batadv_tt_common_entry *common,
>  				    u8 flags)
>  	__must_hold(&common->flags_lock)

[Severity: Low]
At this commit, batadv_tt_local_set_pending() in
net/batman-adv/translation-table.c doesn't follow the new rule. It still
ignores the return value and always sets the PENDING flag:

net/batman-adv/translation-table.c:batadv_tt_local_set_pending() {
    ...
	__batadv_tt_local_event(bat_priv, common, common->flags | flags);
	common->flags |= BATADV_TT_CLIENT_PENDING;
    ...
}

This DEL path has two callers. One is batadv_tt_local_remove_entry(),
including the roaming DEL with BATADV_TT_CLIENT_ROAM. The other is
batadv_tt_local_purge_list() for timed out clients.

If the GFP_ATOMIC allocation in __batadv_tt_local_event() fails there,
the entry ends up marked PENDING, and possibly ROAM, with no DEL queued.
At the next commit, batadv_tt_local_purge_pending_clients() unhashes
every PENDING entry. So the removal is never announced to the other
nodes.

The silent loss of the DEL already happened before this patch. What this
patch adds is a kerneldoc rule that this caller breaks. Should the
kerneldoc name batadv_tt_local_set_pending() as an exception here, or
should set_pending check the new return value?

The next patch in the series, "batman-adv: tt: requeue DEL of pending
local entry after failed allocation", seems to fix both. It adds
tt_local->del_unqueued, which batadv_tt_local_set_pending() sets when
the DEL was not queued. batadv_tt_local_purge_list() then requeues the
DEL, and pending entries with del_unqueued set are not unhashed. That
patch also rewords the kerneldoc to say that the DEL of
batadv_tt_local_set_pending() is the only exception.

[ ... ]

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

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

Thread overview: 27+ 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-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-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
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 [this message]
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-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-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=179554084314.3135.7493792255015362398@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