02 Dec, 2016

1 commit

  • batadv_tt_prepare_tvlv_local_data can fail to allocate the memory for the
    new TVLV block. The caller is informed about this problem with the returned
    length of 0. Not checking this value results in an invalid memory access
    when either tt_data or tt_change is accessed.

    Reported-by: Dan Carpenter
    Fixes: 7ea7b4a14275 ("batman-adv: make the TT CRC logic VLAN specific")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

04 Nov, 2016

2 commits

  • The throughput meter detects different situations as problems for the
    current test. It stops the test after these and reports it to userspace.
    This also has to be done when the primary interface disappeared during the
    test.

    Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation")
    Reported-by: Joe Perches
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The commit 9799c50372b2 ("batman-adv: fix splat on disabling an interface")
    fixed a warning but at the same time broke the rtnl function add_slave for
    devices which were temporarily removed.

    batadv_softif_slave_add requires soft_iface of and hard_iface to be NULL
    before it is allowed to be enslaved. But this resetting of soft_iface to
    NULL in batadv_hardif_disable_interface was removed with the aforementioned
    commit.

    Reported-by: Julian Labus
    Signed-off-by: Sven Eckelmann
    Acked-by: Linus Lüssing
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

21 Oct, 2016

1 commit

  • As long as there is still a reference for a hard interface held, there might
    still be a forwarding packet relying on its attributes.

    Therefore avoid setting hard_iface->soft_iface to NULL when disabling a hard
    interface.

    This fixes the following, potential splat:

    batman_adv: bat0: Interface deactivated: eth1
    batman_adv: bat0: Removing interface: eth1
    cgroup: new mount options do not match the existing superblock, will be ignored
    batman_adv: bat0: Interface deactivated: eth3
    batman_adv: bat0: Removing interface: eth3
    ------------[ cut here ]------------
    WARNING: CPU: 3 PID: 1986 at ./net/batman-adv/bat_iv_ogm.c:549 batadv_iv_send_outstanding_bat_ogm_packet+0x145/0x643 [batman_adv]
    Modules linked in: batman_adv(O-)
    CPU: 3 PID: 1986 Comm: kworker/u8:2 Tainted: G W O 4.6.0-rc6+ #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
    Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet [batman_adv]
    0000000000000000 ffff88001d93bca0 ffffffff8126c26b 0000000000000000
    0000000000000000 ffff88001d93bcf0 ffffffff81051615 ffff88001f19f818
    000002251d93bd68 0000000000000046 ffff88001dc04a00 ffff88001becbe48
    Call Trace:
    [] dump_stack+0x67/0x90
    [] __warn+0xc7/0xe5
    [] warn_slowpath_null+0x18/0x1a
    [] batadv_iv_send_outstanding_bat_ogm_packet+0x145/0x643 [batman_adv]
    [] ? __lock_is_held+0x32/0x54
    [] process_one_work+0x2a8/0x4f5
    [] ? process_one_work+0x15c/0x4f5
    [] worker_thread+0x1d5/0x2c0
    [] ? process_scheduled_works+0x2e/0x2e
    [] ? process_scheduled_works+0x2e/0x2e
    [] kthread+0xc0/0xc8
    [] ret_from_fork+0x22/0x40
    [] ? __init_kthread_worker+0x55/0x55
    ---[ end trace 647f9f325123dc05 ]---

    What happened here is, that there was still a forw_packet (here: a BATMAN IV
    OGM) in the queue of eth3 with the forw_packet->if_incoming set to eth1 and the
    forw_packet->if_outgoing set to eth3.

    When eth3 is to be deactivated and removed, then this thread waits for the
    forw_packet queued on eth3 to finish. Because eth1 was deactivated and removed
    earlier and by that had forw_packet->if_incoming->soft_iface, set to NULL, the
    splat when trying to send/flush the OGM on eth3 occures.

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Linus Lüssing
    [sven@narfation.org: Reduced size of Oops message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     

17 Oct, 2016

2 commits

  • The BATADV_DBG_ALL has to contain the bit of BATADV_DBG_TP_METER to really
    support all available debug messages.

    Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The batadv_hard_iface::neigh_list is accessed via rcu based primitives.
    Thus all operations done on it have to fulfill the requirements by RCU. So
    using non-RCU mechanisms like hlist_add_head is not allowed because it
    misses the barriers required to protect concurrent readers when accessing
    the data behind the pointer.

    Fixes: cef63419f7db ("batman-adv: add list of unique single hop neighbors per hard-interface")
    Signed-off-by: Sven Eckelmann
    Acked-by: Linus Lüssing
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

12 Oct, 2016

1 commit

  • Kernel source files need not include explicitly
    because the top Makefile forces to include it with:

    -include $(srctree)/include/linux/kconfig.h

    This commit removes explicit includes except the following:

    * arch/s390/include/asm/facilities_src.h
    * tools/testing/radix-tree/linux/kernel.h

    These two are used for host programs.

    Link: http://lkml.kernel.org/r/1473656164-11929-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

23 Sep, 2016

1 commit


02 Sep, 2016

1 commit


26 Aug, 2016

2 commits

  • The skb_reserve() call only reserved headroom for the mac header, but
    not the elp packet header itself.

    Fixing this by using skb_put()'ing towards the skb tail instead of
    skb_push()'ing towards the skb head.

    Fixes: d6f94d91f766 ("batman-adv: ELP - adding basic infrastructure")
    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • batadv_find_router dereferences last_bonding_candidate from
    orig_node without making sure that it has a valid reference. This reference
    has to be retrieved by increasing the reference counter while holding
    neigh_list_lock. The lock is required to avoid that
    batadv_last_bonding_replace removes the current last_bonding_candidate,
    reduces the reference counter and maybe destroys the object in this
    process.

    Fixes: f3b3d9018975 ("batman-adv: add bonding again")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

09 Aug, 2016

29 commits

  • The files provided by batman-adv via debugfs are currently converted to
    netlink. Tools which are not yet converted to use the netlink interface may
    still rely on the old debugfs files. But systems which already upgraded
    their tools can save some space by disabling this feature. The default
    configuration of batman-adv on amd64 can reduce the size of the module by
    around 11% when this feature is disabled.

    $ size net/batman-adv/batman-adv.ko*
    text data bss dec hex filename
    150507 10395 4160 165062 284c6 net/batman-adv/batman-adv.ko.y
    137106 7099 2112 146317 23b8d net/batman-adv/batman-adv.ko.n

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • Switch-like virtual interfaces like bridge or openvswitch don't destroy
    itself when all their attached netdevices dissappear. Instead they only
    remove the link to the unregistered device and keep working until they get
    removed manually.

    This has the benefit that all configurations for this interfaces are kept
    and daemons reacting to rtnl events can just add new slave interfaces
    without going through the complete configuration of the switch-like
    netdevice.

    Handling unregister events of client devices similar in batman-adv allows
    users to drop their current workaround of dummy netdevices attached to
    batman-adv soft-interfaces.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • Set the netnsof flag on the family structure, indicating it can
    be used with different network name spaces.

    Signed-off-by: Andrew Lunn
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    Andrew Lunn
     
  • Dump the list of bridge loop avoidance backbones via the netlink socket.

    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    Simon Wunderlich
     
  • The bridge loop avoidange is the main information for the debugging of of
    bridge loop detection problems. It is therefore necessary when comparing
    the bla claim tables.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Sven Eckelmann
     
  • Dump the list of bridge loop avoidance claims via the netlink socket.

    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: add policy for attributes, fix includes, fix
    soft_iface reference leak]
    Signed-off-by: Sven Eckelmann
    [sw@simonwunderlich.de: fix kerneldoc, fix error reporting]
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Andrew Lunn
     
  • Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • Dump the list of gateways via the netlink socket.

    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: integrate in batadv_algo_ops]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Andrew Lunn
     
  • Add BATADV_CMD_GET_GATEWAYS commands, using handlers bat_gw_dump in
    batadv_algo_ops. Will always return -EOPNOTSUPP for now, as no
    implementations exist yet.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • Dump the algo V originators and neighbours.

    Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven@narfation.org: Fix includes, fix algo_ops integration]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer
     
  • Signed-off-by: Matthias Schiffer
    Signed-off-by: Andrew Lunn
    [sven.eckelmann@open-mesh.com: Fix function parameter alignments,
    add policy for attributes, fix includes, fix algo_ops integration]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner

    Matthias Schiffer