Project

General

Profile

Actions

Bug #487

open

tt: handle batadv_tvlv_container_register error

Added by Sven Eckelmann 15 days ago.

Status:
New
Priority:
Normal
Target version:
-
Start date:
10/31/2026
Due date:
% Done:

0%

Estimated time:

Description

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261030135105.2555887-1-sw%40simonwunderlich.de?part=13

Discovered by: gpt-6-astra · Missed by: opus-5-5 · Confirmed by: opus-5-5 · Ranked High by: gpt-6-astra
This isn't a bug introduced by this patch, but should the same retry
also cover a failure in batadv_tvlv_container_register()?
The ogm_append_cnt reset is only on the
batadv_tt_prepare_tvlv_local_data() failure branch. The success path
still ends like this:
net/batman-adv/translation-table.c:batadv_tt_tvlv_container_update() {
    ...
container_register:
    batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data,
                       tvlv_len);
    kfree(tt_data);
}
batadv_tvlv_container_register() returns void and gives up silently
when its allocation fails:
net/batman-adv/tvlv.c:batadv_tvlv_container_register() {
    ...
    tvlv_new = kzalloc(sizeof(*tvlv_new) + tvlv_value_len, GFP_ATOMIC);
    if (!tvlv_new)
        return;
    ...
}
When that happens the old TT container, which still carries the previous
TTVN, stays registered.
A commit with changes has already incremented tt.vn and set
ogm_append_cnt to BATADV_TT_OGM_APPEND_MAX before it calls
batadv_tt_tvlv_container_update(). If no new local events arrive, the
next rounds in batadv_tt_local_commit_changes_nolock() only take this
branch:
    if (changes_num == 0) {
        if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt))
            batadv_tt_tvlv_container_update(bat_priv, &changes_list,
                            changes_num);
        return;
    }
Those rounds only decrement the counter and skip the container update.
So the stale container keeps being announced for up to
BATADV_TT_OGM_APPEND_MAX more OGM intervals, until it is re-registered.
The baseline code behaved the same way: changes were consumed before
registration, and the registration failure was just as silent. The patch
fixes the prepare-allocation failure path but leaves this one as it was.
[ ... ]

No data to display

Actions

Also available in: Atom PDF