1. 23 2月, 2016 2 次提交
  2. 16 2月, 2016 1 次提交
    • S
      batman-adv: Only put orig_node_vlan list reference when removed · 3db15209
      Sven Eckelmann 提交于
      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: 7ea7b4a1 ("batman-adv: make the TT CRC logic VLAN specific")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <a@unstable.cc>
      3db15209
  3. 10 2月, 2016 3 次提交
  4. 02 2月, 2016 5 次提交
  5. 16 1月, 2016 1 次提交
    • S
      batman-adv: Drop immediate orig_node free function · 42eff6a6
      Sven Eckelmann 提交于
      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: 72822225 ("batman-adv: Fix rcu_barrier() miss due to double call_rcu() in TT code")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <a@unstable.cc>
      42eff6a6
  6. 09 1月, 2016 2 次提交
  7. 16 12月, 2015 2 次提交
  8. 07 12月, 2015 2 次提交
  9. 25 8月, 2015 9 次提交
  10. 19 8月, 2015 1 次提交
    • S
      batman-adv: Fix memory leak on tt add with invalid vlan · fd7dec25
      Sven Eckelmann 提交于
      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: 354136bc ("batman-adv: fix kernel crash due to missing NULL checks")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fd7dec25
  11. 15 8月, 2015 2 次提交
  12. 05 8月, 2015 2 次提交
  13. 07 6月, 2015 3 次提交
    • S
    • S
      batman-adv: Add required includes to all files · 1e2c2a4f
      Sven Eckelmann 提交于
      The header files could not be build indepdent from each other. This is
      happened because headers didn't include the files for things they've used.
      This was problematic because the success of a build depended on the
      knowledge about the right order of local includes.
      
      Also source files were not including everything they've used explicitly.
      Instead they required that transitive includes are always stable. This is
      problematic because some transitive includes are not obvious, depend on
      config settings and may not be stable in the future.
      
      The order for include blocks are:
      
       * primary headers (main.h and the *.h file of a *.c file)
       * global linux headers
       * required local headers
       * extra forward declarations for pointers in function/struct declarations
      
      The only exceptions are linux/bitops.h and linux/if_ether.h in packet.h.
      This header file is shared with userspace applications like batctl and must
      therefore build together with userspace applications. The header
      linux/bitops.h is not part of the uapi headers and linux/if_ether.h
      conflicts with the musl implementation of netinet/if_ether.h. The
      maintainers rejected the use of __KERNEL__ preprocessor checks and thus
      these two headers are only in main.h. All files using packet.h first have
      to include main.h to work correctly.
      Reported-by: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      1e2c2a4f
    • S
      batman-adv: Use common Jenkins Hash implementation · 36fd61cb
      Sven Eckelmann 提交于
      An unoptimized version of the Jenkins one-at-a-time hash function is used
      and partially copied all over the code wherever an hashtable is used.
      Instead the optimized version shared between the whole kernel should be
      used to reduce code duplication and use better optimized code.
      
      Only the DAT code must use the old implementation because it is used as
      distributed hash function which has to be common for all nodes.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      36fd61cb
  14. 29 5月, 2015 1 次提交
  15. 08 1月, 2015 3 次提交
  16. 21 7月, 2014 1 次提交
    • A
      batman-adv: fix TT VLAN inconsistency on VLAN re-add · 35df3b29
      Antonio Quartulli 提交于
      When a VLAN interface (on top of batX) is removed and
      re-added within a short timeframe TT does not have enough
      time to properly cleanup. This creates an internal TT state
      mismatch as the newly created softif_vlan will be
      initialized from scratch with a TT client count of zero
      (even if TT entries for this VLAN still exist). The
      resulting TT messages are bogus due to the counter / tt
      client listing mismatch, thus creating inconsistencies on
      every node in the network
      
      To fix this issue destroy_vlan() has to not free the VLAN
      object immediately but it has to be kept alive until all the
      TT entries for this VLAN have been removed. destroy_vlan()
      still removes the sysfs folder so that the user has the
      feeling that everything went fine.
      
      If the same VLAN is re-added before the old object is free'd,
      then the latter is resurrected and re-used.
      
      Implement such behaviour by increasing the reference counter
      of a softif_vlan object every time a new local TT entry for
      such VLAN is created and remove the object from the list
      only when all the TT entries have been destroyed.
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      35df3b29