• Sven Eckelmann's avatar
    batman-adv: Fix internal interface indices types · f22e0893
    Sven Eckelmann authored
    batman-adv uses internal indices for each enabled and active interface.
    It is currently used by the B.A.T.M.A.N. IV algorithm to identifify the
    correct position in the ogm_cnt bitmaps.
    
    The type for the number of enabled interfaces (which defines the next
    interface index) was set to char. This type can be (depending on the
    architecture) either signed (limiting batman-adv to 127 active slave
    interfaces) or unsigned (limiting batman-adv to 255 active slave
    interfaces).
    
    This limit was not correctly checked when an interface was enabled and thus
    an overflow happened. This was only catched on systems with the signed char
    type when the B.A.T.M.A.N. IV code tried to resize its counter arrays with
    a negative size.
    
    The if_num interface index was only a s16 and therefore significantly
    smaller than the ifindex (int) used by the code net code.
    
    Both &batadv_hard_iface->if_num and &batadv_priv->num_ifaces must be
    (unsigned) int to support the same number of slave interfaces as the net
    core code. And the interface activation code must check the number of
    active slave interfaces to avoid integer overflows.
    
    Fixes: c6c8fea2 ("net: Add batman-adv meshing protocol")
    Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
    Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
    f22e0893
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
bat_algo.c Loading commit data...
bat_algo.h Loading commit data...
bat_iv_ogm.c Loading commit data...
bat_iv_ogm.h Loading commit data...
bat_v.c Loading commit data...
bat_v.h Loading commit data...
bat_v_elp.c Loading commit data...
bat_v_elp.h Loading commit data...
bat_v_ogm.c Loading commit data...
bat_v_ogm.h Loading commit data...
bitarray.c Loading commit data...
bitarray.h Loading commit data...
bridge_loop_avoidance.c Loading commit data...
bridge_loop_avoidance.h Loading commit data...
debugfs.c Loading commit data...
debugfs.h Loading commit data...
distributed-arp-table.c Loading commit data...
distributed-arp-table.h Loading commit data...
fragmentation.c Loading commit data...
fragmentation.h Loading commit data...
gateway_client.c Loading commit data...
gateway_client.h Loading commit data...
gateway_common.c Loading commit data...
gateway_common.h Loading commit data...
hard-interface.c Loading commit data...
hard-interface.h Loading commit data...
hash.c Loading commit data...
hash.h Loading commit data...
icmp_socket.c Loading commit data...
icmp_socket.h Loading commit data...
log.c Loading commit data...
log.h Loading commit data...
main.c Loading commit data...
main.h Loading commit data...
multicast.c Loading commit data...
multicast.h Loading commit data...
netlink.c Loading commit data...
netlink.h Loading commit data...
network-coding.c Loading commit data...
network-coding.h Loading commit data...
originator.c Loading commit data...
originator.h Loading commit data...
routing.c Loading commit data...
routing.h Loading commit data...
send.c Loading commit data...
send.h Loading commit data...
soft-interface.c Loading commit data...
soft-interface.h Loading commit data...
sysfs.c Loading commit data...
sysfs.h Loading commit data...
tp_meter.c Loading commit data...
tp_meter.h Loading commit data...
translation-table.c Loading commit data...
translation-table.h Loading commit data...
tvlv.c Loading commit data...
tvlv.h Loading commit data...
types.h Loading commit data...