1. 31 5月, 2019 2 次提交
    • L
      batman-adv: allow updating DAT entry timeouts on incoming ARP Replies · 25204fe6
      Linus Lüssing 提交于
      [ Upstream commit 099e6cc1582dc2903fecb898bbeae8f7cf4262c7 ]
      
      Currently incoming ARP Replies, for example via a DHT-PUT message, do
      not update the timeout for an already existing DAT entry. These ARP
      Replies are dropped instead.
      
      This however defeats the purpose of the DHCPACK snooping, for instance.
      Right now, a DAT entry in the DHT will be purged every five minutes,
      likely leading to a mesh-wide ARP Request broadcast after this timeout.
      Which then recreates the entry. The idea of the DHCPACK snooping is to
      be able to update an entry before a timeout happens, to avoid ARP Request
      flooding.
      
      This patch fixes this issue by updating a DAT entry on incoming
      ARP Replies even if a matching DAT entry already exists. While still
      filtering the ARP Reply towards the soft-interface, to avoid duplicate
      messages on the client device side.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      25204fe6
    • L
      batman-adv: mcast: fix multicast tt/tvlv worker locking · 363aa80a
      Linus Lüssing 提交于
      commit a3c7cd0cdf1107f891aff847ad481e34df727055 upstream.
      
      Syzbot has reported some issues with the locking assumptions made for
      the multicast tt/tvlv worker: It was able to trigger the WARN_ON() in
      batadv_mcast_mla_tt_retract() and batadv_mcast_mla_tt_add().
      While hard/not reproduceable for us so far it seems that the
      delayed_work_pending() we use might not be quite safe from reordering.
      
      Therefore this patch adds an explicit, new spinlock to protect the
      update of the mla_list and flags in bat_priv and then removes the
      WARN_ON(delayed_work_pending()).
      
      Reported-by: syzbot+83f2d54ec6b7e417e13f@syzkaller.appspotmail.com
      Reported-by: syzbot+050927a651272b145a5d@syzkaller.appspotmail.com
      Reported-by: syzbot+979ffc89b87309b1b94b@syzkaller.appspotmail.com
      Reported-by: syzbot+f9f3f388440283da2965@syzkaller.appspotmail.com
      Fixes: cbebd363 ("batman-adv: Use own timer for multicast TT and TVLV updates")
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      363aa80a
  2. 08 5月, 2019 4 次提交
    • A
      batman-adv: fix warning in function batadv_v_elp_get_throughput · 894b4fc0
      Anders Roxell 提交于
      [ Upstream commit ca8c3b922e7032aff6cc3fd05548f4df1f3df90e ]
      
      When CONFIG_CFG80211 isn't enabled the compiler correcly warns about
      'sinfo.pertid' may be unused. It can also happen for other error
      conditions that it not warn about.
      
      net/batman-adv/bat_v_elp.c: In function ‘batadv_v_elp_get_throughput.isra.0’:
      include/net/cfg80211.h:6370:13: warning: ‘sinfo.pertid’ may be used
       uninitialized in this function [-Wmaybe-uninitialized]
        kfree(sinfo->pertid);
              ~~~~~^~~~~~~~
      
      Rework so that we only release '&sinfo' if cfg80211_get_station returns
      zero.
      
      Fixes: 7d652669b61d ("batman-adv: release station info tidstats")
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      894b4fc0
    • S
      batman-adv: Reduce tt_global hash refcnt only for removed entry · 7afe374c
      Sven Eckelmann 提交于
      [ Upstream commit f131a56880d10932931e74773fb8702894a94a75 ]
      
      The batadv_hash_remove is a function which searches the hashtable for an
      entry using a needle, a hashtable bucket selection function and a compare
      function. It will lock the bucket list and delete an entry when the compare
      function matches it with the needle. It returns the pointer to the
      hlist_node which matches or NULL when no entry matches the needle.
      
      The batadv_tt_global_free is not itself protected in anyway to avoid that
      any other function is modifying the hashtable between the search for the
      entry and the call to batadv_hash_remove. It can therefore happen that the
      entry either doesn't exist anymore or an entry was deleted which is not the
      same object as the needle. In such an situation, the reference counter (for
      the reference stored in the hashtable) must not be reduced for the needle.
      Instead the reference counter of the actually removed entry has to be
      reduced.
      
      Otherwise the reference counter will underflow and the object might be
      freed before all its references were dropped. The kref helpers reported
      this problem as:
      
        refcount_t: underflow; use-after-free.
      
      Fixes: 7683fdc1 ("batman-adv: protect the local and the global trans-tables with rcu")
      Reported-by: NMartin Weinelt <martin@linuxlounge.net>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      7afe374c
    • S
      batman-adv: Reduce tt_local hash refcnt only for removed entry · 6957021d
      Sven Eckelmann 提交于
      [ Upstream commit 3d65b9accab4a7ed5038f6df403fbd5e298398c7 ]
      
      The batadv_hash_remove is a function which searches the hashtable for an
      entry using a needle, a hashtable bucket selection function and a compare
      function. It will lock the bucket list and delete an entry when the compare
      function matches it with the needle. It returns the pointer to the
      hlist_node which matches or NULL when no entry matches the needle.
      
      The batadv_tt_local_remove is not itself protected in anyway to avoid that
      any other function is modifying the hashtable between the search for the
      entry and the call to batadv_hash_remove. It can therefore happen that the
      entry either doesn't exist anymore or an entry was deleted which is not the
      same object as the needle. In such an situation, the reference counter (for
      the reference stored in the hashtable) must not be reduced for the needle.
      Instead the reference counter of the actually removed entry has to be
      reduced.
      
      Otherwise the reference counter will underflow and the object might be
      freed before all its references were dropped. The kref helpers reported
      this problem as:
      
        refcount_t: underflow; use-after-free.
      
      Fixes: ef72706a ("batman-adv: protect tt_local_entry from concurrent delete events")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      6957021d
    • S
      batman-adv: Reduce claim hash refcnt only for removed entry · be807f9b
      Sven Eckelmann 提交于
      [ Upstream commit 4ba104f468bbfc27362c393815d03aa18fb7a20f ]
      
      The batadv_hash_remove is a function which searches the hashtable for an
      entry using a needle, a hashtable bucket selection function and a compare
      function. It will lock the bucket list and delete an entry when the compare
      function matches it with the needle. It returns the pointer to the
      hlist_node which matches or NULL when no entry matches the needle.
      
      The batadv_bla_del_claim is not itself protected in anyway to avoid that
      any other function is modifying the hashtable between the search for the
      entry and the call to batadv_hash_remove. It can therefore happen that the
      entry either doesn't exist anymore or an entry was deleted which is not the
      same object as the needle. In such an situation, the reference counter (for
      the reference stored in the hashtable) must not be reduced for the needle.
      Instead the reference counter of the actually removed entry has to be
      reduced.
      
      Otherwise the reference counter will underflow and the object might be
      freed before all its references were dropped. The kref helpers reported
      this problem as:
      
        refcount_t: underflow; use-after-free.
      
      Fixes: 23721387 ("batman-adv: add basic bridge loop avoidance code")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      be807f9b
  3. 14 3月, 2019 1 次提交
  4. 27 2月, 2019 1 次提交
    • E
      batman-adv: fix uninit-value in batadv_interface_tx() · c580bb31
      Eric Dumazet 提交于
      [ 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 <48> 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: c6c8fea2 ("net: Add batman-adv meshing protocol")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Cc:	Marek Lindner <mareklindner@neomailbox.ch>
      Cc:	Simon Wunderlich <sw@simonwunderlich.de>
      Cc:	Antonio Quartulli <a@unstable.cc>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c580bb31
  5. 15 2月, 2019 2 次提交
    • S
      batman-adv: Force mac header to start of data on xmit · 4dd911f1
      Sven Eckelmann 提交于
      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: c6c8fea2 ("net: Add batman-adv meshing protocol")
      Reported-by: syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com
      Reported-by: syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4dd911f1
    • S
      batman-adv: Avoid WARN on net_device without parent in netns · a2122230
      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: b7eddd0b ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface")
      Reported-by: syzbot+c764de0fcfadca9a8595@syzkaller.appspotmail.com
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2122230
  6. 13 12月, 2018 2 次提交
    • S
      batman-adv: Expand merged fragment buffer for full packet · 2e959f25
      Sven Eckelmann 提交于
      [ Upstream commit d7d8bbb4 ]
      
      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: 610bfc6b ("batman-adv: Receive fragmented packets and merge")
      Reported-by: NMartin Weinelt <martin@darmstadt.freifunk.net>
      Co-authored-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2e959f25
    • S
      batman-adv: Use explicit tvlv padding for ELP packets · 25683acc
      Sven Eckelmann 提交于
      [ Upstream commit f4156f96 ]
      
      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: d6f94d91 ("batman-adv: ELP - adding basic infrastructure")
      Reported-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      25683acc
  7. 14 9月, 2018 1 次提交
  8. 07 9月, 2018 2 次提交
  9. 06 9月, 2018 8 次提交
    • S
      batman-adv: Prevent duplicated tvlv handler · ae3cdc97
      Sven Eckelmann 提交于
      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: ef261577 ("batman-adv: tvlv - basic infrastructure")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      ae3cdc97
    • S
      batman-adv: Prevent duplicated global TT entry · e7136e48
      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: d657e621 ("batman-adv: add reference counting for type batadv_tt_orig_list_entry")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      e7136e48
    • S
      batman-adv: Prevent duplicated softif_vlan entry · 94cb82f5
      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: 5d2c05b2 ("batman-adv: add per VLAN interface attribute framework")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      94cb82f5
    • S
      batman-adv: Prevent duplicated nc_node entry · fa122fec
      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: d56b1705 ("batman-adv: network coding - detect coding nodes and remove these after timeout")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      fa122fec
    • S
      batman-adv: Prevent duplicated gateway_node entry · dff9bc42
      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: c6c8fea2 ("net: Add batman-adv meshing protocol")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      dff9bc42
    • S
      batman-adv: Fix segfault when writing to sysfs elp_interval · a25bab9d
      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: 0744ff8f ("batman-adv: Add hard_iface specific sysfs wrapper macros for UINT")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      a25bab9d
    • S
      batman-adv: Fix segfault when writing to throughput_override · b9fd14c2
      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: 0b5ecc68 ("batman-adv: add throughput override attribute to hard_ifaces")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Acked-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      b9fd14c2
    • S
      batman-adv: Avoid probe ELP information leak · 88d0895d
      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: NSven Eckelmann <sven@narfation.org>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      88d0895d
  10. 08 7月, 2018 3 次提交
  11. 05 7月, 2018 1 次提交
  12. 23 6月, 2018 10 次提交
  13. 14 5月, 2018 2 次提交
  14. 13 5月, 2018 1 次提交
    • M
      batman-adv: prevent TT request storms by not sending inconsistent TT TLVLs · 16116dac
      Marek Lindner 提交于
      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: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      16116dac