• Antonio Quartulli's avatar
    batman-adv: fix race condition in TT full-table replacement · 8b8e4bc0
    Antonio Quartulli authored
    bug introduced with cea194d90b11aff7fc289149e4c7f305fad3535a
    
    In the current TT code, when a TT_Response containing a full table is received
    from an originator, first the node purges all the clients for that originator in
    the global translation-table and then merges the newly received table.
    During the purging phase each client deletion is done by means of a call_rcu()
    invocation and at the end of this phase the global entry counter for that
    originator is set to 0. However the invoked rcu function decreases the global
    entry counter for that originator by one too and since the rcu invocation is
    likely to be postponed, the node will end up in first setting the counter to 0
    and then decreasing it one by one for each deleted client.
    
    This bug leads to having a wrong global entry counter for the related node, say
    X. Then when the node with the broken counter will answer to a TT_REQUEST on
    behalf of node X, it will create faulty TT_RESPONSE that will generate an
    unrecoverable situation on the node that asked for the full table recover.
    
    The non-recoverability is given by the fact that the node with the broken
    counter will keep answering on behalf of X because its knowledge about X's state
    (ttvn + tt_crc) is correct.
    
    To solve this problem the counter is not explicitly set to 0 anymore and the
    counter decrement is performed right before the invocation of call_rcu().
    Signed-off-by: 's avatarAntonio Quartulli <ordex@autistici.org>
    8b8e4bc0
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
bat_algo.h Loading commit data...
bat_debugfs.c Loading commit data...
bat_debugfs.h Loading commit data...
bat_iv_ogm.c Loading commit data...
bat_sysfs.c Loading commit data...
bat_sysfs.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...
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...
main.c Loading commit data...
main.h Loading commit data...
originator.c Loading commit data...
originator.h Loading commit data...
packet.h Loading commit data...
ring_buffer.c Loading commit data...
ring_buffer.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...
translation-table.c Loading commit data...
translation-table.h Loading commit data...
types.h Loading commit data...
unicast.c Loading commit data...
unicast.h Loading commit data...
vis.c Loading commit data...
vis.h Loading commit data...