diff options
| author | Sven Eckelmann <sven@narfation.org> | 2026-09-27 13:18:17 +0200 |
|---|---|---|
| committer | Sven Eckelmann <sven@narfation.org> | 2026-09-27 18:58:14 +0200 |
| commit | a6746cb1907615a37acf26f7e529a022e99876a0 (patch) | |
| tree | 9ee0f7ea6e999d039354e55a03f8b44a1bb9c877 /include/linux/timerqueue.h | |
| parent | f95b9f28a9df609be434c645d9de632041285262 (diff) | |
batman-adv: tt: queue local DEL event before marking entry as pending
batadv_tt_local_set_pending() originally queued the DEL change event and
only afterwards set BATADV_TT_CLIENT_PENDING on the local entry. Commit
976b159b3c12 ("batman-adv: tt: use protected flag modifications") inverted
this order for batadv_tt_local_remove() and batadv_tt_local_purge_list().
The hash bucket list_lock held around both steps does not help against
batadv_tt_local_add_existing() because it is not holding it.
CPU0 CPU1
flags |= ..._PENDING;
batadv_tt_local_add_existing()
flags &= ~..._PENDING;
batadv_tt_local_event(ADD)
batadv_tt_local_event(DEL)
If the ADD was already announced by a commit in between, the DEL is sent in
the next TTVN although the entry is no longer pending (after
batadv_tt_local_add_existing()) and the local entry was never purged. The
incorrect DEL will corrupt the CRC on neighbor nodes. A full table sync
request is therefore issued to resolve this problem.
When the DEL event is queued before the flag is set, a
batadv_tt_local_add_existing() which clears the flag afterwards queues its
ADD behind the DEL, and both cancel each other out.
But the check whether an entry has to be removed must not be separated (by
using two different critial flags_lock sections) from setting the flag (in
batadv_tt_local_event) either. Otherwise batadv_tt_local_add_existing()
could refresh the entry between both steps without queuing an ADD, and an
active client would be announced as removed and purged.
Fixes: 976b159b3c12 ("batman-adv: tt: use protected flag modifications")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260831135117.574836-1-sw%40simonwunderlich.de?part=12
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
