14 Mar, 2019

1 commit

  • [ Upstream commit 7d652669b61d702c6e62a39579d17f6881670ab6 ]

    With the addition of TXQ stats in the per-tid statistics the struct
    station_info grew significantly. This resulted in stack size warnings
    due to the structure itself being above the limit for the warnings.

    To work around this, the TID array was allocated dynamically. Also a
    function to free this content was introduced with commit 7ea3e110f2f8
    ("cfg80211: release station info tidstats where needed") but the necessary
    changes were not provided for batman-adv's B.A.T.M.A.N. V implementation.

    Signed-off-by: Felix Fietkau
    Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
    [sven@narfation.org: add commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin

    Felix Fietkau
     

27 Feb, 2019

1 commit

  • [ Upstream commit 4ffcbfac60642f63ae3d80891f573ba7e94a265c ]

    KMSAN reported batadv_interface_tx() was possibly using a
    garbage value [1]

    batadv_get_vid() does have a pskb_may_pull() call
    but batadv_interface_tx() does not actually make sure
    this did not fail.

    [1]
    BUG: KMSAN: uninit-value in batadv_interface_tx+0x908/0x1e40 net/batman-adv/soft-interface.c:231
    CPU: 0 PID: 10006 Comm: syz-executor469 Not tainted 4.20.0-rc7+ #5
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x173/0x1d0 lib/dump_stack.c:113
    kmsan_report+0x12e/0x2a0 mm/kmsan/kmsan.c:613
    __msan_warning+0x82/0xf0 mm/kmsan/kmsan_instr.c:313
    batadv_interface_tx+0x908/0x1e40 net/batman-adv/soft-interface.c:231
    __netdev_start_xmit include/linux/netdevice.h:4356 [inline]
    netdev_start_xmit include/linux/netdevice.h:4365 [inline]
    xmit_one net/core/dev.c:3257 [inline]
    dev_hard_start_xmit+0x607/0xc40 net/core/dev.c:3273
    __dev_queue_xmit+0x2e42/0x3bc0 net/core/dev.c:3843
    dev_queue_xmit+0x4b/0x60 net/core/dev.c:3876
    packet_snd net/packet/af_packet.c:2928 [inline]
    packet_sendmsg+0x8306/0x8f30 net/packet/af_packet.c:2953
    sock_sendmsg_nosec net/socket.c:621 [inline]
    sock_sendmsg net/socket.c:631 [inline]
    __sys_sendto+0x8c4/0xac0 net/socket.c:1788
    __do_sys_sendto net/socket.c:1800 [inline]
    __se_sys_sendto+0x107/0x130 net/socket.c:1796
    __x64_sys_sendto+0x6e/0x90 net/socket.c:1796
    do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
    entry_SYSCALL_64_after_hwframe+0x63/0xe7
    RIP: 0033:0x441889
    Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff ff 0f 83 bb 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
    RSP: 002b:00007ffdda6fd468 EFLAGS: 00000216 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 0000000000441889
    RDX: 000000000000000e RSI: 00000000200000c0 RDI: 0000000000000003
    RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000216 R12: 00007ffdda6fd4c0
    R13: 00007ffdda6fd4b0 R14: 0000000000000000 R15: 0000000000000000

    Uninit was created at:
    kmsan_save_stack_with_flags mm/kmsan/kmsan.c:204 [inline]
    kmsan_internal_poison_shadow+0x92/0x150 mm/kmsan/kmsan.c:158
    kmsan_kmalloc+0xa6/0x130 mm/kmsan/kmsan_hooks.c:176
    kmsan_slab_alloc+0xe/0x10 mm/kmsan/kmsan_hooks.c:185
    slab_post_alloc_hook mm/slab.h:446 [inline]
    slab_alloc_node mm/slub.c:2759 [inline]
    __kmalloc_node_track_caller+0xe18/0x1030 mm/slub.c:4383
    __kmalloc_reserve net/core/skbuff.c:137 [inline]
    __alloc_skb+0x309/0xa20 net/core/skbuff.c:205
    alloc_skb include/linux/skbuff.h:998 [inline]
    alloc_skb_with_frags+0x1c7/0xac0 net/core/skbuff.c:5220
    sock_alloc_send_pskb+0xafd/0x10e0 net/core/sock.c:2083
    packet_alloc_skb net/packet/af_packet.c:2781 [inline]
    packet_snd net/packet/af_packet.c:2872 [inline]
    packet_sendmsg+0x661a/0x8f30 net/packet/af_packet.c:2953
    sock_sendmsg_nosec net/socket.c:621 [inline]
    sock_sendmsg net/socket.c:631 [inline]
    __sys_sendto+0x8c4/0xac0 net/socket.c:1788
    __do_sys_sendto net/socket.c:1800 [inline]
    __se_sys_sendto+0x107/0x130 net/socket.c:1796
    __x64_sys_sendto+0x6e/0x90 net/socket.c:1796
    do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
    entry_SYSCALL_64_after_hwframe+0x63/0xe7

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Eric Dumazet
    Reported-by: syzbot
    Cc: Marek Lindner
    Cc: Simon Wunderlich
    Cc: Antonio Quartulli
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Eric Dumazet
     

15 Feb, 2019

2 commits

  • commit 9114daa825fc3f335f9bea3313ce667090187280 upstream.

    The caller of ndo_start_xmit may not already have called
    skb_reset_mac_header. The returned value of skb_mac_header/eth_hdr
    therefore can be in the wrong position and even outside the current skbuff.
    This for example happens when the user binds to the device using a
    PF_PACKET-SOCK_RAW with enabled qdisc-bypass:

    int opt = 4;
    setsockopt(sock, SOL_PACKET, PACKET_QDISC_BYPASS, &opt, sizeof(opt));

    Since eth_hdr is used all over the codebase, the batadv_interface_tx
    function must always take care of resetting it.

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Reported-by: syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com
    Reported-by: syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     
  • commit 955d3411a17f590364238bd0d3329b61f20c1cd2 upstream.

    It is not allowed to use WARN* helpers on potential incorrect input from
    the user or transient problems because systems configured as panic_on_warn
    will reboot due to such a problem.

    A NULL return value of __dev_get_by_index can be caused by various problems
    which can either be related to the system configuration or problems
    (incorrectly returned network namespaces) in other (virtual) net_device
    drivers. batman-adv should not cause a (harmful) WARN in this situation and
    instead only report it via a simple message.

    Fixes: b7eddd0b3950 ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
    Reported-by: syzbot+c764de0fcfadca9a8595@syzkaller.appspotmail.com
    Reported-by: Dmitry Vyukov
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Greg Kroah-Hartman

    Sven Eckelmann
     

13 Dec, 2018

2 commits

  • [ Upstream commit d7d8bbb40a5b1f682ee6589e212934f4c6b8ad60 ]

    The complete size ("total_size") of the fragmented packet is stored in the
    fragment header and in the size of the fragment chain. When the fragments
    are ready for merge, the skbuff's tail of the first fragment is expanded to
    have enough room after the data pointer for at least total_size. This means
    that it gets expanded by total_size - first_skb->len.

    But this is ignoring the fact that after expanding the buffer, the fragment
    header is pulled by from this buffer. Assuming that the tailroom of the
    buffer was already 0, the buffer after the data pointer of the skbuff is
    now only total_size - len(fragment_header) large. When the merge function
    is then processing the remaining fragments, the code to copy the data over
    to the merged skbuff will cause an skb_over_panic when it tries to actually
    put enough data to fill the total_size bytes of the packet.

    The size of the skb_pull must therefore also be taken into account when the
    buffer's tailroom is expanded.

    Fixes: 610bfc6bc99b ("batman-adv: Receive fragmented packets and merge")
    Reported-by: Martin Weinelt
    Co-authored-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Sasha Levin

    Sven Eckelmann
     
  • [ Upstream commit f4156f9656feac21f4de712fac94fae964c5d402 ]

    The announcement messages of batman-adv COMPAT_VERSION 15 have the
    possibility to announce additional information via a dynamic TVLV part.
    This part is optional for the ELP packets and currently not parsed by the
    Linux implementation. Still out-of-tree versions are using it to transport
    things like neighbor hashes to optimize the rebroadcast behavior.

    Since the ELP broadcast packets are smaller than the minimal ethernet
    packet, it often has to be padded. This is often done (as specified in
    RFC894) with octets of zero and thus work perfectly fine with the TVLV
    part (making it a zero length and thus empty). But not all ethernet
    compatible hardware seems to follow this advice. To avoid ambiguous
    situations when parsing the TVLV header, just force the 4 bytes (TVLV
    length + padding) after the required ELP header to zero.

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

    Sven Eckelmann
     

14 Sep, 2018

1 commit


07 Sep, 2018

2 commits


06 Sep, 2018

8 commits

  • The function batadv_tvlv_handler_register is responsible for adding new
    tvlv_handler to the handler_list. It first checks whether the entry
    already is in the list or not. If it is, then the creation of a new entry
    is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The function batadv_tt_global_orig_entry_add is responsible for adding new
    tt_orig_list_entry to the orig_list. It first checks whether the entry
    already is in the list or not. If it is, then the creation of a new entry
    is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: d657e621a0f5 ("batman-adv: add reference counting for type batadv_tt_orig_list_entry")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The function batadv_softif_vlan_get is responsible for adding new
    softif_vlan to the softif_vlan_list. It first checks whether the entry
    already is in the list or not. If it is, then the creation of a new entry
    is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: 5d2c05b21337 ("batman-adv: add per VLAN interface attribute framework")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The function batadv_nc_get_nc_node is responsible for adding new nc_nodes
    to the in_coding_list and out_coding_list. It first checks whether the
    entry already is in the list or not. If it is, then the creation of a new
    entry is aborted.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: d56b1705e28c ("batman-adv: network coding - detect coding nodes and remove these after timeout")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The function batadv_gw_node_add is responsible for adding new gw_node to
    the gateway_list. It is expecting that the caller already checked that
    there is not already an entry with the same key or not.

    But the lock for the list is only held when the list is really modified.
    This could lead to duplicated entries because another context could create
    an entry with the same key between the check and the list manipulation.

    The check and the manipulation of the list must therefore be in the same
    locked code section.

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The per hardif sysfs file "batman_adv/elp_interval" is using the generic
    functions to store/show uint values. The helper __batadv_store_uint_attr
    requires the softif net_device as parameter to print the resulting change
    as info text when the users writes to this file. It uses the helper
    function batadv_info to add it at the same time to the kernel ring buffer
    and to the batman-adv debug log (when CONFIG_BATMAN_ADV_DEBUG is enabled).

    The function batadv_info requires as first parameter the batman-adv softif
    net_device. This parameter is then used to find the private buffer which
    contains the debug log for this batman-adv interface. But
    batadv_store_throughput_override used as first argument the slave
    net_device. This slave device doesn't have the batadv_priv private data
    which is access by batadv_info.

    Writing to this file with CONFIG_BATMAN_ADV_DEBUG enabled can either lead
    to a segfault or to memory corruption.

    Fixes: 0744ff8fa8fa ("batman-adv: Add hard_iface specific sysfs wrapper macros for UINT")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The per hardif sysfs file "batman_adv/throughput_override" prints the
    resulting change as info text when the users writes to this file. It uses
    the helper function batadv_info to add it at the same time to the kernel
    ring buffer and to the batman-adv debug log (when CONFIG_BATMAN_ADV_DEBUG
    is enabled).

    The function batadv_info requires as first parameter the batman-adv softif
    net_device. This parameter is then used to find the private buffer which
    contains the debug log for this batman-adv interface. But
    batadv_store_throughput_override used as first argument the slave
    net_device. This slave device doesn't have the batadv_priv private data
    which is access by batadv_info.

    Writing to this file with CONFIG_BATMAN_ADV_DEBUG enabled can either lead
    to a segfault or to memory corruption.

    Fixes: 0b5ecc6811bd ("batman-adv: add throughput override attribute to hard_ifaces")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • The probe ELPs for WiFi interfaces are expanded to contain at least
    BATADV_ELP_MIN_PROBE_SIZE bytes. This is usually a lot more than the
    number of bytes which the template ELP packet requires.

    These extra padding bytes were not initialized and thus could contain data
    which were previously stored at the same location. It is therefore required
    to set it to some predefined or random values to avoid leaking private
    information from the system transmitting these kind of packets.

    Fixes: e4623c913508 ("batman-adv: Avoid probe ELP information leak")
    Signed-off-by: Sven Eckelmann
    Acked-by: Antonio Quartulli
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     

21 Jul, 2018

1 commit


18 Jul, 2018

1 commit

  • Simon Wunderlich says:

    ====================
    This feature/cleanup patchset includes the following patches:

    - Don't call BATMAN_V experimental in Kconfig anymore, by Sven Eckelmann

    - Enable DAT by default at compile time, by Antonio Quartulli

    - Remove obsolete default n in Kconfig, by Sven Eckelmann

    - Fix checkpatch spelling errors, by Sven Eckelmann

    - Unify header guards style, by Sven Eckelmann

    - Consolidate batadv_purge_orig functions, by Sven Eckelmann

    - Replace type define with proper typedef, by Sven Eckelmann
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

08 Jul, 2018

3 commits


05 Jul, 2018

1 commit


23 Jun, 2018

10 commits

  • The "default n" is the default value for any bool or tristate Kconfig
    setting. It is therefore not necessary to add it to a config entry.

    Reported-by: Sergei Shtylyov
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • DAT (Distributed ARP Table) has been enabled by default
    in the out-of-tree batman-adv kernel module for several
    years already.
    It can now be enabled in the kernel too.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Antonio Quartulli
     
  • The Kconfig option BATMAN_ADV_BATMAN_V is now enabled by default when the
    BATMAN_ADV is enabled. A feature which is enabled by default for a module
    should not be considered experimental.

    Reported-by: Joe Perches
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • When a (broken) node wrongly sends multicast TT entries with a ROAM
    flag then this causes any receiving node to drop all entries for the
    same multicast MAC address announced by other nodes, leading to
    packet loss.

    Fix this DoS vector by only storing TT sync flags. For multicast TT
    non-sync'ing flag bits like ROAM are unused so far anyway.

    Fixes: 1d8ab8d3c176 ("batman-adv: Modified forwarding behaviour for multicast packets")
    Reported-by: Leonardo Mörlein
    Signed-off-by: Linus Lüssing
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • Since commit 54e22f265e87 ("batman-adv: fix TT sync flag inconsistencies")
    TT sync flags and TT non-sync'd flags are supposed to be stored
    separately.

    The previous patch missed to apply this separation on a TT entry with
    only a single TT orig entry.

    This is a minor fix because with only a single TT orig entry the DDoS
    issue the former patch solves does not apply.

    Fixes: 54e22f265e87 ("batman-adv: fix TT sync flag inconsistencies")
    Signed-off-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     
  • batman-adv is creating special debugfs directories in the init
    net_namespace for each created soft-interface (batadv net_device). But it
    is possible to rename a net_device to a completely different name then the
    original one.

    It can therefore happen that a user registers a new batadv net_device with
    the name "bat0". batman-adv is then also adding a new directory under
    $debugfs/batman-adv/ with the name "wlan0".

    The user then decides to rename this device to "bat1" and registers a
    different batadv device with the name "bat0". batman-adv will then try to
    create a directory with the name "bat0" under $debugfs/batman-adv/ again.
    But there already exists one with this name under this path and thus this
    fails. batman-adv will detect a problem and rollback the registering of
    this device.

    batman-adv must therefore take care of renaming the debugfs directories for
    soft-interfaces whenever it detects such a net_device rename.

    Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • batman-adv is creating special debugfs directories in the init
    net_namespace for each valid hard-interface (net_device). But it is
    possible to rename a net_device to a completely different name then the
    original one.

    It can therefore happen that a user registers a new net_device which gets
    the name "wlan0" assigned by default. batman-adv is also adding a new
    directory under $debugfs/batman-adv/ with the name "wlan0".

    The user then decides to rename this device to "wl_pri" and registers a
    different device. The kernel may now decide to use the name "wlan0" again
    for this new device. batman-adv will detect it as a valid net_device and
    tries to create a directory with the name "wlan0" under
    $debugfs/batman-adv/. But there already exists one with this name under
    this path and thus this fails. batman-adv will detect a problem and
    rollback the registering of this device.

    batman-adv must therefore take care of renaming the debugfs directories
    for hard-interfaces whenever it detects such a net_device rename.

    Fixes: 5bc7c1eb44f2 ("batman-adv: add debugfs structure for information per interface")
    Reported-by: John Soros
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • A reference for the best gateway is taken when the list of gateways in the
    mesh is sent via netlink. This is necessary to check whether the currently
    dumped entry is the currently selected gateway or not. This information is
    then transferred as flag BATADV_ATTR_FLAG_BEST.

    After the comparison of the current entry is done,
    batadv_v_gw_dump_entry() has to decrease the reference counter again.
    Otherwise the reference will be held and thus prevents a proper shutdown of
    the batman-adv interfaces (and some of the interfaces enslaved in it).

    Fixes: b71bb6f924fe ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • A reference for the best gateway is taken when the list of gateways in the
    mesh is sent via netlink. This is necessary to check whether the currently
    dumped entry is the currently selected gateway or not. This information is
    then transferred as flag BATADV_ATTR_FLAG_BEST.

    After the comparison of the current entry is done,
    batadv_iv_gw_dump_entry() has to decrease the reference counter again.
    Otherwise the reference will be held and thus prevents a proper shutdown of
    the batman-adv interfaces (and some of the interfaces enslaved in it).

    Fixes: efb766af06e3 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations")
    Reported-by: Andreas Ziegler
    Tested-by: Andreas Ziegler
    Signed-off-by: Sven Eckelmann
    Acked-by: Marek Lindner
    Signed-off-by: Simon Wunderlich

    Sven Eckelmann
     
  • random_ether_addr is a #define for eth_random_addr which is
    generally preferred in kernel code by ~3:1

    Convert the uses of random_ether_addr to enable removing the #define

    Miscellanea:

    o Convert &vfmac[0] to equivalent vfmac and avoid unnecessary line wrap

    Signed-off-by: Joe Perches
    Acked-by: Jeff Kirsher
    Signed-off-by: David S. Miller

    Joe Perches
     

27 May, 2018

1 commit


14 May, 2018

2 commits

  • Signed-off-by: Marek Lindner
    Acked-by: Antonio Quartulli
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Marek Lindner
     
  • Virtual interface drivers such as tun / tap interfaces, VLAN, etc tend
    to initialize the interface throughput with some value for the sake of
    having a throughput number to export via ethtool. This exported
    throughput leaves batman-adv to conclude the interface throughput is
    genuine (reflecting reality), thus no measurements are necessary.

    Based on the observation that those interface types also tend to set
    the link auto-negotiation to 'off', batman-adv shall check this
    setting to differentiate between genuine link throughput information
    and placeholders installed by virtual interfaces.

    The "default throughput" setting exported via sysfs still allows to
    configure the batman-adv throughput for the interface, thus disabling
    the measurements.

    Signed-off-by: Marek Lindner
    Acked-by: Antonio Quartulli
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Marek Lindner
     

13 May, 2018

2 commits

  • A translation table TVLV changset sent with an OGM consists
    of a number of headers (one per VLAN) plus the changeset
    itself (addition and/or deletion of entries).

    The per-VLAN headers are used by OGM recipients for consistency
    checks. Said consistency check might determine that a full
    translation table request is needed to restore consistency. If
    the TT sender adds per-VLAN headers of empty VLANs into the OGM,
    recipients are led to believe to have reached an inconsistent
    state and thus request a full table update. The full table does
    not contain empty VLANs (due to missing entries) the cycle
    restarts when the next OGM is issued.

    Consequently, when the translation table TVLV headers are
    composed, empty VLANs are to be excluded.

    Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific")
    Signed-off-by: Marek Lindner
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Marek Lindner
     
  • The previous TT sync fix so far only fixed TT responses issued by the
    target node directly. So far, TT responses issued by intermediate nodes
    still lead to the wrong flags being added, leading to CRC mismatches.

    This behaviour was observed at Freifunk Hannover in a 800 nodes setup
    where a considerable amount of nodes were still infected with 'WI'
    TT flags even with (most) nodes having the previous TT sync fix applied.

    I was able to reproduce the issue with intermediate TT responses in a
    four node test setup and this patch fixes this issue by ensuring to
    use the per originator instead of the summarized, OR'd ones.

    Fixes: e9c00136a475 ("batman-adv: fix tt_global_entries flags update")
    Reported-by: Leonardo Mörlein
    Signed-off-by: Linus Lüssing
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Linus Lüssing
     

10 May, 2018

1 commit

  • The functions batadv_tt_prepare_tvlv_local_data and
    batadv_tt_prepare_tvlv_global_data are responsible for preparing a buffer
    which can be used to store the TVLV container for TT and add the VLAN
    information to it.

    This will be done in three phases:

    1. count the number of VLANs and their entries
    2. allocate the buffer using the counters from the previous step and limits
    from the caller (parameter tt_len)
    3. insert the VLAN information to the buffer

    The step 1 and 3 operate on a list which contains the VLANs. The access to
    these lists must be protected with an appropriate lock or otherwise they
    might operate on on different entries. This could for example happen when
    another context is adding VLAN entries to this list.

    This could lead to a buffer overflow in these functions when enough entries
    were added between step 1 and 3 to the VLAN lists that the buffer room for
    the entries (*tt_change) is smaller then the now required extra buffer for
    new VLAN entries.

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

    Sven Eckelmann
     

26 Apr, 2018

1 commit

  • The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
    which is a typedef for an enum type, but the implementation in this
    driver returns an 'int'.

    Fix this by returning 'netdev_tx_t' in this driver too.

    Signed-off-by: Luc Van Oostenryck
    [sven@narfation.org: fixed alignment]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Simon Wunderlich

    Luc Van Oostenryck