29 Apr, 2016

1 commit

  • The batadv_tt_local_entry was specific to a batadv_softif_vlan and held an
    implicit reference to it. But this reference was never stored in form of a
    pointer in the tt_local_entry itself. Instead batadv_tt_local_remove,
    batadv_tt_local_table_free and batadv_tt_local_purge_pending_clients depend
    on a consistent state of bat_priv->softif_vlan_list and that
    batadv_softif_vlan_get always returns the batadv_softif_vlan object which
    it has a reference for. But batadv_softif_vlan_get cannot guarantee that
    because it is working only with rcu_read_lock on this list. It can
    therefore happen that an vid is in this list twice or that
    batadv_softif_vlan_get cannot find the batadv_softif_vlan for an vid due to
    some other list operations taking place at the same time.

    Instead add a batadv_softif_vlan pointer directly in batadv_tt_local_entry
    which will be used for the reference counter decremented on release of
    batadv_tt_local_entry.

    Fixes: 35df3b298fc8 ("batman-adv: fix TT VLAN inconsistency on VLAN re-add")
    Signed-off-by: Sven Eckelmann
    Acked-by: Antonio Quartulli
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

23 Feb, 2016

9 commits


16 Feb, 2016

1 commit

  • The batadv_orig_node_vlan reference counter in batadv_tt_global_size_mod
    can only be reduced when the list entry was actually removed. Otherwise the
    reference counter may reach zero when batadv_tt_global_size_mod is called
    from two different contexts for the same orig_node_vlan but only one
    context is actually removing the entry from the list.

    The release function for this orig_node_vlan is not called inside the
    vlan_list_lock spinlock protected region because the function
    batadv_tt_global_size_mod still holds a orig_node_vlan reference for the
    object pointer on the stack. Thus the actual release function (when
    required) will be called only at the end of the function.

    Fixes: 7ea7b4a14275 ("batman-adv: make the TT CRC logic VLAN specific")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

10 Feb, 2016

3 commits

  • batman-adv uses a self-written reference implementation which is just based
    on atomic_t. This is less obvious when reading the code than kref and
    therefore increases the change that the reference counting will be missed.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     
  • batman-adv uses a self-written reference implementation which is just based
    on atomic_t. This is less obvious when reading the code than kref and
    therefore increases the change that the reference counting will be missed.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     
  • batman-adv uses a self-written reference implementation which is just based
    on atomic_t. This is less obvious when reading the code than kref and
    therefore increases the change that the reference counting will be missed.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

02 Feb, 2016

5 commits


16 Jan, 2016

1 commit

  • It is not allowed to free the memory of an object which is part of a list
    which is protected by rcu-read-side-critical sections without making sure
    that no other context is accessing the object anymore. This usually happens
    by removing the references to this object and then waiting until the rcu
    grace period is over and no one (allowedly) accesses it anymore.

    But the _now functions ignore this completely. They free the object
    directly even when a different context still tries to access it. This has
    to be avoided and thus these functions must be removed and all functions
    have to use batadv_orig_node_free_ref.

    Fixes: 72822225bd41 ("batman-adv: Fix rcu_barrier() miss due to double call_rcu() in TT code")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

09 Jan, 2016

2 commits


18 Dec, 2015

1 commit


16 Dec, 2015

2 commits


07 Dec, 2015

2 commits

  • The translation table implementation, namely batadv_compare_tt(),
    is used to compare two client entries and deciding if they are the
    holding the same information. Each client entry is identified by
    its mac address and its VLAN id (VID).
    Consequently, batadv_compare_tt() has to not only compare the mac
    addresses but also the VIDs.

    Without this fix adding a new client entry that possesses the same
    mac address as another client but operates on a different VID will
    fail because both client entries will considered identical.

    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Marek Lindner
     
  • In the case when a temporary entry is added first and a proper tt entry
    is added after that, the temporary tt entry is kept in the orig list.
    However the temporary flag is removed at this point, and therefore the
    purge function can not find this temporary entry anymore.

    Therefore, remove the previous temp entry before adding the new proper
    one.

    This case can happen if a client behind a given originator moves before
    the TT announcement is sent out. Other than that, this case can also be
    created by bogus or malicious payload frames for VLANs which are not
    existent on the sending originator.

    Reported-by: Alessandro Bolletta
    Signed-off-by: Simon Wunderlich
    Acked-by: Antonio Quartulli
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     

25 Aug, 2015

9 commits


22 Aug, 2015

1 commit


19 Aug, 2015

1 commit

  • The object tt_local is allocated with kmalloc and not initialized when the
    function batadv_tt_local_add checks for the vlan. But this function can
    only cleanup the object when the (not yet initialized) reference counter of
    the object is 1. This is unlikely and thus the object would leak when the
    vlan could not be found.

    Instead the uninitialized object tt_local has to be freed manually and the
    pointer has to set to NULL to avoid calling the function which would try to
    decrement the reference counter of the not existing object.

    CID: 1316518
    Fixes: 354136bcc3c4 ("batman-adv: fix kernel crash due to missing NULL checks")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: David S. Miller

    Sven Eckelmann
     

18 Aug, 2015

1 commit

  • Antonio Quartulli says:

    ====================
    Included changes:
    - avoid integer overflow in GW selection routine
    - prevent race condition by making capability bit changes atomic (use
    clear/set/test_bit)
    - fix synchronization issue in mcast tvlv handler
    - fix crash on double list removal of TT Request objects
    - fix leak by puring packets enqueued for sending upon iface removal
    - ensure network header pointer is set in skb
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

15 Aug, 2015

1 commit