In the Linux kernel, the following vulnerability has been resolved: batman-adv: tt: don't drop local events queued during TVLV update batadv_tt_tvlv_container_update() read the number of local changes without holding changes_list_lock. batadv_tt_local_event() is not serialized by the commit_lock and can queue new events before the changes_list is flushed: CPU0 CPU1 batadv_tt_tvlv_container_update() num = ...local_changes; batadv_tt_local_event() list_add_tail(...); ...local_changes++; spin_lock_bh(&...changes_list_lock); /* only num events copied but all freed */ The additional events were freed without ever being sent. Другие узлы заметят это только через несоответствие CRC и должны запросить полную таблицу. Следовательно, число изменений и changes_list должны быть приняты атомарно.
После этого события выстроились в очередь, а затем остались в tt.changes_list для следующего раунда TT. Изменения больше не могут быть сохранены для следующего раунда, когда распределение буфера TVLV не удается. Но они будут отправлены с пропущенным TTVN в любом случае, поэтому другие узлы должны запросить полную таблицу в этом случае в любом случае.
Последний набор изменений удаляется только в этом случае, когда TTVN был увеличен. Без новых изменений он по-прежнему описывает текущий TTVN. Ранее неиспользованные изменения вызвали повторную попытку обновления контейнера TVLV в следующем раунде фиксации.
Поскольку изменения теперь потребляются, следующий раунд будет проходить только без изменений и ждать раундов BATADV_TT_OGM_APPEND_MAX, прежде чем обновлять контейнер снова. До тех пор устаревший контейнер с предыдущим TTVN все еще будет объявлен. Поэтому ogm_append_cnt сбрасывается при невозможности повторить обновление в следующем интервале OGM.
Это не делает CRC совместимым с анонсированным набором изменений. Модификации локальной таблицы по-прежнему не сериализованы с коммитом, и batadv_tt_local_transition_new() все еще может стать клиентской частью CRC, для которой событие является только частью следующего раунда TT. Такое несоответствие обнаруживается при проверке CRC других узлов и решается с помощью полного запроса таблицы.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: batman-adv: tt: don't drop local events queued during TVLV update batadv_tt_tvlv_container_update() read the number of local changes without holding changes_list_lock. batadv_tt_local_event() is not serialized by the commit_lock and can queue new events before the changes_list is flushed: CPU0 CPU1 batadv_tt_tvlv_container_update() num = ...local_changes; batadv_tt_local_event() list_add_tail(...); ...local_changes++; spin_lock_bh(&...changes_list_lock); /* only num events copied but all freed */ The additional events were freed without ever being sent. Other nodes will only notice this via a CRC mismatch and must request the full table. The number of changes and the changes_list must therefore be taken atomically. Events queued afterwards then stay in the tt.changes_list for the next TT round. The changes can no longer be kept for the next round when the TVLV buffer allocation fails. But they would be sent with a skipped TTVN anyway, so the other nodes have to request the full table in this case either way. The last changeset is only dropped in this case when the TTVN was incremented. Without new changes, it still describes the current TTVN. Previously, the unconsumed changes caused a retry of the TVLV container update in the next commit round. Since the changes are now consumed, the next round would only take the path without changes and wait for BATADV_TT_OGM_APPEND_MAX rounds before updating the container again. Until then, the outdated container with the previous TTVN would still be announced. The ogm_append_cnt is therefore reset on failure to retry the update in the next OGM interval. This doesn't make the CRC consistent with the announced changeset. The local table modifications are still not serialized with the commit and batadv_tt_local_transition_new() can still make a client part of the CRC for which the event is only part of the next TT round. Such an inconsistency is detected by the CRC check of the other nodes and solved via a full table request.