kernel-aes67/net/batman-adv
Sven Eckelmann b1f532a3b1 batman-adv: Avoid infinite loop trying to resize local TT
If the MTU of one of an attached interface becomes too small to transmit
the local translation table then it must be resized to fit inside all
fragments (when enabled) or a single packet.

But if the MTU becomes too low to transmit even the header + the VLAN
specific part then the resizing of the local TT will never succeed. This
can for example happen when the usable space is 110 bytes and 11 VLANs are
on top of batman-adv. In this case, at least 116 byte would be needed.
There will just be an endless spam of

   batman_adv: batadv0: Forced to purge local tt entries to fit new maximum fragment MTU (110)

in the log but the function will never finish. Problem here is that the
timeout will be halved all the time and will then stagnate at 0 and
therefore never be able to reduce the table even more.

There are other scenarios possible with a similar result. The number of
BATADV_TT_CLIENT_NOPURGE entries in the local TT can for example be too
high to fit inside a packet. Such a scenario can therefore happen also with
only a single VLAN + 7 non-purgable addresses - requiring at least 120
bytes.

While this should be handled proactively when:

* interface with too low MTU is added
* VLAN is added
* non-purgeable local mac is added
* MTU of an attached interface is reduced
* fragmentation setting gets disabled (which most likely requires dropping
  attached interfaces)

not all of these scenarios can be prevented because batman-adv is only
consuming events without the the possibility to prevent these actions
(non-purgable MAC address added, MTU of an attached interface is reduced).
It is therefore necessary to also make sure that the code is able to handle
also the situations when there were already incompatible system
configuration are present.

Cc: stable@vger.kernel.org
Fixes: a19d3d85e1 ("batman-adv: limit local translation table max size")
Reported-by: syzbot+a6a4b5bb3da165594cff@syzkaller.appspotmail.com
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
2024-03-29 20:18:43 +01:00
..
Kconfig
Makefile
bat_algo.c
bat_algo.h
bat_iv_ogm.c
bat_iv_ogm.h
bat_v.c
bat_v.h
bat_v_elp.c
bat_v_elp.h
bat_v_ogm.c
bat_v_ogm.h
bitarray.c
bitarray.h
bridge_loop_avoidance.c batman-adv: Switch to linux/sprintf.h 2023-11-14 08:16:34 +01:00
bridge_loop_avoidance.h
distributed-arp-table.c batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data() 2024-01-27 09:13:59 +01:00
distributed-arp-table.h
fragmentation.c
fragmentation.h
gateway_client.c batman-adv: Switch to linux/sprintf.h 2023-11-14 08:16:34 +01:00
gateway_client.h
gateway_common.c
gateway_common.h
hard-interface.c
hard-interface.h
hash.c
hash.h
log.c
log.h
main.c batman-adv: Improve exception handling in batadv_throw_uevent() 2024-01-27 09:13:59 +01:00
main.h batman-adv: Start new development cycle 2024-01-27 09:13:58 +01:00
multicast.c batman-adv: mcast: fix memory leak on deleting a batman-adv interface 2024-01-27 09:13:39 +01:00
multicast.h batman-adv: mcast: implement multicast packet generation 2023-11-14 08:16:34 +01:00
multicast_forw.c batman-adv: mcast: shrink tracker packet after scrubbing 2023-11-14 08:16:34 +01:00
netlink.c batman-adv: Drop usage of export.h 2024-01-27 09:13:59 +01:00
netlink.h
network-coding.c
network-coding.h
originator.c
originator.h
routing.c
routing.h
send.c
send.h
soft-interface.c batman-adv: mcast: implement multicast packet generation 2023-11-14 08:16:34 +01:00
soft-interface.h
tp_meter.c
tp_meter.h
trace.c
trace.h
translation-table.c batman-adv: Avoid infinite loop trying to resize local TT 2024-03-29 20:18:43 +01:00
translation-table.h
tvlv.c
tvlv.h
types.h batman-adv: mcast: implement multicast packet generation 2023-11-14 08:16:34 +01:00