]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
batman-adv: tvlv: abort OGM send on tvlv append failure
authorSven Eckelmann <sven@narfation.org>
Thu, 14 May 2026 14:33:12 +0000 (16:33 +0200)
committerSven Eckelmann <sven@narfation.org>
Tue, 19 May 2026 06:16:21 +0000 (08:16 +0200)
commit501368506563e151b322c8c3f228b796e615b90d
tree44e638e4ea8dfa5148e03d820823021ba10f91ae
parentf8ce8b8331a1bc44ad4905886a482214d428b253
batman-adv: tvlv: abort OGM send on tvlv append failure

batadv_tvlv_container_ogm_append() could fail in two ways: a memory
allocation failure when resizing the packet buffer, or the tvlv data
exceeding U16_MAX bytes. In both cases the function previously returned the
old (now stale) tvlv_value_len rather than signalling an error, causing the
OGM/OGM2 send path to transmit a packet whose TVLV length field no longer
matched the actual buffer contents. And because it also didn't fill in the
new TVLV data, sending either uninitialized or corrupted data on the wire.

All errors in batadv_tvlv_container_ogm_append() must be forwarded to the
caller. And the caller must abort the send of the OGM2. For B.A.T.M.A.N.
IV, it is currently not allowed to abort the send. The non-TVLV part of the
OGM must be queued up instead.

Cc: stable@kernel.org
Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_v_ogm.c
net/batman-adv/tvlv.c
net/batman-adv/tvlv.h