1. 31 7月, 2020 1 次提交
  2. 25 6月, 2020 1 次提交
  3. 25 5月, 2020 1 次提交
    • L
      mac80211: mesh: fix discovery timer re-arming issue / crash · e2d4a80f
      Linus Lüssing 提交于
      On a non-forwarding 802.11s link between two fairly busy
      neighboring nodes (iperf with -P 16 at ~850MBit/s TCP;
      1733.3 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 4), so with
      frequent PREQ retries, usually after around 30-40 seconds the
      following crash would occur:
      
      [ 1110.822428] Unable to handle kernel read from unreadable memory at virtual address 00000000
      [ 1110.830786] Mem abort info:
      [ 1110.833573]   Exception class = IABT (current EL), IL = 32 bits
      [ 1110.839494]   SET = 0, FnV = 0
      [ 1110.842546]   EA = 0, S1PTW = 0
      [ 1110.845678] user pgtable: 4k pages, 48-bit VAs, pgd = ffff800076386000
      [ 1110.852204] [0000000000000000] *pgd=00000000f6322003, *pud=00000000f62de003, *pmd=0000000000000000
      [ 1110.861167] Internal error: Oops: 86000004 [#1] PREEMPT SMP
      [ 1110.866730] Modules linked in: pppoe ppp_async batman_adv ath10k_pci ath10k_core ath pppox ppp_generic nf_conntrack_ipv6 mac80211 iptable_nat ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_FLOWOFFLOAD slhc nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_nat nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack iptable_mangle iptable_filter ip_tables crc_ccitt compat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 usb_storage xhci_plat_hcd xhci_pci xhci_hcd dwc3 usbcore usb_common
      [ 1110.932190] Process swapper/3 (pid: 0, stack limit = 0xffff0000090c8000)
      [ 1110.938884] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.14.162 #0
      [ 1110.944965] Hardware name: LS1043A RGW Board (DT)
      [ 1110.949658] task: ffff8000787a81c0 task.stack: ffff0000090c8000
      [ 1110.955568] PC is at 0x0
      [ 1110.958097] LR is at call_timer_fn.isra.27+0x24/0x78
      [ 1110.963055] pc : [<0000000000000000>] lr : [<ffff0000080ff29c>] pstate: 00400145
      [ 1110.970440] sp : ffff00000801be10
      [ 1110.973744] x29: ffff00000801be10 x28: ffff000008bf7018
      [ 1110.979047] x27: ffff000008bf87c8 x26: ffff000008c160c0
      [ 1110.984352] x25: 0000000000000000 x24: 0000000000000000
      [ 1110.989657] x23: dead000000000200 x22: 0000000000000000
      [ 1110.994959] x21: 0000000000000000 x20: 0000000000000101
      [ 1111.000262] x19: ffff8000787a81c0 x18: 0000000000000000
      [ 1111.005565] x17: ffff0000089167b0 x16: 0000000000000058
      [ 1111.010868] x15: ffff0000089167b0 x14: 0000000000000000
      [ 1111.016172] x13: ffff000008916788 x12: 0000000000000040
      [ 1111.021475] x11: ffff80007fda9af0 x10: 0000000000000001
      [ 1111.026777] x9 : ffff00000801bea0 x8 : 0000000000000004
      [ 1111.032080] x7 : 0000000000000000 x6 : ffff80007fda9aa8
      [ 1111.037383] x5 : ffff00000801bea0 x4 : 0000000000000010
      [ 1111.042685] x3 : ffff00000801be98 x2 : 0000000000000614
      [ 1111.047988] x1 : 0000000000000000 x0 : 0000000000000000
      [ 1111.053290] Call trace:
      [ 1111.055728] Exception stack(0xffff00000801bcd0 to 0xffff00000801be10)
      [ 1111.062158] bcc0:                                   0000000000000000 0000000000000000
      [ 1111.069978] bce0: 0000000000000614 ffff00000801be98 0000000000000010 ffff00000801bea0
      [ 1111.077798] bd00: ffff80007fda9aa8 0000000000000000 0000000000000004 ffff00000801bea0
      [ 1111.085618] bd20: 0000000000000001 ffff80007fda9af0 0000000000000040 ffff000008916788
      [ 1111.093437] bd40: 0000000000000000 ffff0000089167b0 0000000000000058 ffff0000089167b0
      [ 1111.101256] bd60: 0000000000000000 ffff8000787a81c0 0000000000000101 0000000000000000
      [ 1111.109075] bd80: 0000000000000000 dead000000000200 0000000000000000 0000000000000000
      [ 1111.116895] bda0: ffff000008c160c0 ffff000008bf87c8 ffff000008bf7018 ffff00000801be10
      [ 1111.124715] bdc0: ffff0000080ff29c ffff00000801be10 0000000000000000 0000000000400145
      [ 1111.132534] bde0: ffff8000787a81c0 ffff00000801bde8 0000ffffffffffff 000001029eb19be8
      [ 1111.140353] be00: ffff00000801be10 0000000000000000
      [ 1111.145220] [<          (null)>]           (null)
      [ 1111.149917] [<ffff0000080ff77c>] run_timer_softirq+0x184/0x398
      [ 1111.155741] [<ffff000008081938>] __do_softirq+0x100/0x1fc
      [ 1111.161130] [<ffff0000080a2e28>] irq_exit+0x80/0xd8
      [ 1111.166002] [<ffff0000080ea708>] __handle_domain_irq+0x88/0xb0
      [ 1111.171825] [<ffff000008081678>] gic_handle_irq+0x68/0xb0
      [ 1111.177213] Exception stack(0xffff0000090cbe30 to 0xffff0000090cbf70)
      [ 1111.183642] be20:                                   0000000000000020 0000000000000000
      [ 1111.191461] be40: 0000000000000001 0000000000000000 00008000771af000 0000000000000000
      [ 1111.199281] be60: ffff000008c95180 0000000000000000 ffff000008c19360 ffff0000090cbef0
      [ 1111.207101] be80: 0000000000000810 0000000000000400 0000000000000098 ffff000000000000
      [ 1111.214920] bea0: 0000000000000001 ffff0000089167b0 0000000000000000 ffff0000089167b0
      [ 1111.222740] bec0: 0000000000000000 ffff000008c198e8 ffff000008bf7018 ffff000008c19000
      [ 1111.230559] bee0: 0000000000000000 0000000000000000 ffff8000787a81c0 ffff000008018000
      [ 1111.238380] bf00: ffff00000801c000 ffff00000913ba34 ffff8000787a81c0 ffff0000090cbf70
      [ 1111.246199] bf20: ffff0000080857cc ffff0000090cbf70 ffff0000080857d0 0000000000400145
      [ 1111.254020] bf40: ffff000008018000 ffff00000801c000 ffffffffffffffff ffff0000080fa574
      [ 1111.261838] bf60: ffff0000090cbf70 ffff0000080857d0
      [ 1111.266706] [<ffff0000080832e8>] el1_irq+0xe8/0x18c
      [ 1111.271576] [<ffff0000080857d0>] arch_cpu_idle+0x10/0x18
      [ 1111.276880] [<ffff0000080d7de4>] do_idle+0xec/0x1b8
      [ 1111.281748] [<ffff0000080d8020>] cpu_startup_entry+0x20/0x28
      [ 1111.287399] [<ffff00000808f81c>] secondary_start_kernel+0x104/0x110
      [ 1111.293662] Code: bad PC value
      [ 1111.296710] ---[ end trace 555b6ca4363c3edd ]---
      [ 1111.301318] Kernel panic - not syncing: Fatal exception in interrupt
      [ 1111.307661] SMP: stopping secondary CPUs
      [ 1111.311574] Kernel Offset: disabled
      [ 1111.315053] CPU features: 0x0002000
      [ 1111.318530] Memory Limit: none
      [ 1111.321575] Rebooting in 3 seconds..
      
      With some added debug output / delays we were able to push the crash from
      the timer callback runner into the callback function and by that shedding
      some light on which object holding the timer gets corrupted:
      
      [  401.720899] Unable to handle kernel read from unreadable memory at virtual address 00000868
      [...]
      [  402.335836] [<ffff0000088fafa4>] _raw_spin_lock_bh+0x14/0x48
      [  402.341548] [<ffff000000dbe684>] mesh_path_timer+0x10c/0x248 [mac80211]
      [  402.348154] [<ffff0000080ff29c>] call_timer_fn.isra.27+0x24/0x78
      [  402.354150] [<ffff0000080ff77c>] run_timer_softirq+0x184/0x398
      [  402.359974] [<ffff000008081938>] __do_softirq+0x100/0x1fc
      [  402.365362] [<ffff0000080a2e28>] irq_exit+0x80/0xd8
      [  402.370231] [<ffff0000080ea708>] __handle_domain_irq+0x88/0xb0
      [  402.376053] [<ffff000008081678>] gic_handle_irq+0x68/0xb0
      
      The issue happens due to the following sequence of events:
      
      1) mesh_path_start_discovery():
      -> spin_unlock_bh(&mpath->state_lock) before mesh_path_sel_frame_tx()
      
      2) mesh_path_free_rcu()
      -> del_timer_sync(&mpath->timer)
         [...]
      -> kfree_rcu(mpath)
      
      3) mesh_path_start_discovery():
      -> mod_timer(&mpath->timer, ...)
         [...]
      -> rcu_read_unlock()
      
      4) mesh_path_free_rcu()'s kfree_rcu():
      -> kfree(mpath)
      
      5) mesh_path_timer() starts after timeout, using freed mpath object
      
      So a use-after-free issue due to a timer re-arming bug caused by an
      early spin-unlocking.
      
      This patch fixes this issue by re-checking if mpath is about to be
      free'd and if so bails out of re-arming the timer.
      
      Cc: stable@vger.kernel.org
      Fixes: 050ac52c ("mac80211: code for on-demand Hybrid Wireless Mesh Protocol")
      Cc: Simon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: NLinus Lüssing <ll@simonwunderlich.de>
      Link: https://lore.kernel.org/r/20200522170413.14973-1-linus.luessing@c0d3.blueSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      e2d4a80f
  4. 11 3月, 2020 1 次提交
  5. 02 1月, 2020 1 次提交
    • M
      mac80211: mesh: restrict airtime metric to peered established plinks · 02a61449
      Markus Theil 提交于
      The following warning is triggered every time an unestablished mesh peer
      gets dumped. Checks if a peer link is established before retrieving the
      airtime link metric.
      
      [ 9563.022567] WARNING: CPU: 0 PID: 6287 at net/mac80211/mesh_hwmp.c:345
                     airtime_link_metric_get+0xa2/0xb0 [mac80211]
      [ 9563.022697] Hardware name: PC Engines apu2/apu2, BIOS v4.10.0.3
      [ 9563.022756] RIP: 0010:airtime_link_metric_get+0xa2/0xb0 [mac80211]
      [ 9563.022838] Call Trace:
      [ 9563.022897]  sta_set_sinfo+0x936/0xa10 [mac80211]
      [ 9563.022964]  ieee80211_dump_station+0x6d/0x90 [mac80211]
      [ 9563.023062]  nl80211_dump_station+0x154/0x2a0 [cfg80211]
      [ 9563.023120]  netlink_dump+0x17b/0x370
      [ 9563.023130]  netlink_recvmsg+0x2a4/0x480
      [ 9563.023140]  ____sys_recvmsg+0xa6/0x160
      [ 9563.023154]  ___sys_recvmsg+0x93/0xe0
      [ 9563.023169]  __sys_recvmsg+0x7e/0xd0
      [ 9563.023210]  do_syscall_64+0x4e/0x140
      [ 9563.023217]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Signed-off-by: NMarkus Theil <markus.theil@tu-ilmenau.de>
      Link: https://lore.kernel.org/r/20191203180644.70653-1-markus.theil@tu-ilmenau.de
      [rewrite commit message]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      02a61449
  6. 19 6月, 2019 1 次提交
  7. 26 4月, 2019 2 次提交
  8. 08 4月, 2019 1 次提交
  9. 08 2月, 2019 1 次提交
    • S
      mac80211: pass bssids to elements parsing function · 4abb52a4
      Sara Sharon 提交于
      In multiple BSSID, we have nested IEs inside the multiple
      BSSID IE, that override the external ones for that specific
      BSS. As preparation for supporting that, pass 2 BSSIDs to the
      parse function, the transmitter, and the selected BSSID, so
      it can know which IEs to choose. If the selected BSSID is
      NULL, the outer ones will be applied.
      
      Change ieee80211_bss_info_update to parse elements itself,
      instead of receiving them parsed, so we have the relevant
      bss entry in hand.
      Signed-off-by: NSara Sharon <sara.sharon@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      4abb52a4
  10. 19 1月, 2019 4 次提交
  11. 10 9月, 2018 1 次提交
    • Y
      mac80211: fix TX status reporting for ieee80211s · c4205510
      Yuan-Chi Pang 提交于
      TX status reporting to ieee80211s is through ieee80211s_update_metric.
      There are two problems about ieee80211s_update_metric:
      
      1. The purpose is to estimate the fail probability
      to a specific link. No need to restrict to data frame.
      
      2. Current implementation does not work if wireless driver does not
      pass tx_status with skb.
      
      Fix this by removing ieee80211_is_data condition, passing
      ieee80211_tx_status directly to ieee80211s_update_metric, and
      putting it in both __ieee80211_tx_status and ieee80211_tx_status_ext.
      Signed-off-by: NYuan-Chi Pang <fu3mo6goo@gmail.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      c4205510
  12. 29 8月, 2018 1 次提交
  13. 11 12月, 2017 1 次提交
  14. 27 11月, 2017 1 次提交
  15. 20 11月, 2017 1 次提交
  16. 21 9月, 2017 1 次提交
    • J
      mac80211: use offsetofend() · 4c121fd6
      Johannes Berg 提交于
      This was created using the following spatch:
          @find@
          type S;
          expression M, M2;
          position p;
          @@
          offsetof(S, M) + sizeof(M2)@p
      
          @script:python@
          m << find.M;
          m2 << find.M2;
          @@
          if not m2.endswith('-> ' + m):
                  cocci.include_match(False)
      
          @change@
          type find.S;
          expression find.M, find.M2;
          position find.p;
          @@
          -offsetof(S, M) + sizeof(M2)@p
          +offsetofend(S, M)
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      4c121fd6
  17. 16 6月, 2017 1 次提交
    • J
      networking: convert many more places to skb_put_zero() · b080db58
      Johannes Berg 提交于
      There were many places that my previous spatch didn't find,
      as pointed out by yuan linyu in various patches.
      
      The following spatch found many more and also removes the
      now unnecessary casts:
      
          @@
          identifier p, p2;
          expression len;
          expression skb;
          type t, t2;
          @@
          (
          -p = skb_put(skb, len);
          +p = skb_put_zero(skb, len);
          |
          -p = (t)skb_put(skb, len);
          +p = skb_put_zero(skb, len);
          )
          ... when != p
          (
          p2 = (t2)p;
          -memset(p2, 0, len);
          |
          -memset(p, 0, len);
          )
      
          @@
          type t, t2;
          identifier p, p2;
          expression skb;
          @@
          t *p;
          ...
          (
          -p = skb_put(skb, sizeof(t));
          +p = skb_put_zero(skb, sizeof(t));
          |
          -p = (t *)skb_put(skb, sizeof(t));
          +p = skb_put_zero(skb, sizeof(t));
          )
          ... when != p
          (
          p2 = (t2)p;
          -memset(p2, 0, sizeof(*p));
          |
          -memset(p, 0, sizeof(*p));
          )
      
          @@
          expression skb, len;
          @@
          -memset(skb_put(skb, len), 0, len);
          +skb_put_zero(skb, len);
      
      Apply it to the tree (with one manual fixup to keep the
      comment in vxlan.c, which spatch removed.)
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b080db58
  18. 06 3月, 2017 2 次提交
  19. 12 9月, 2016 1 次提交
    • P
      mac80211: make mpath path fixing more robust · 5df20f21
      Pedersen, Thomas 提交于
      A fixed mpath was not quite being treated as such:
      
      1) if a PERR frame was received, a fixed mpath was
         deactivated.
      
      2) queued path discovery for fixed mpath was potentially
         being considered, changing mpath state.
      
      3) other mpath flags were potentially being inherited when
         fixing the mpath. Just assign PATH_FIXED and SN_VALID.
      
      This solves several issues when fixing a mesh path in one
      direction. The reverse direction mpath should probably
      also be fixed, or root announcements at least be enabled.
      Signed-off-by: NThomas Pedersen <twp@qca.qualcomm.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      5df20f21
  20. 11 8月, 2016 1 次提交
  21. 06 4月, 2016 2 次提交
    • J
      mac80211: fix "warning: ‘target_metric’ may be used uninitialized" · b4201cc4
      Jeff Mahoney 提交于
      This fixes:
      
      net/mac80211/mesh_hwmp.c:603:26: warning: ‘target_metric’ may be used uninitialized in this function
      
      target_metric is only consumed when reply = true so no bug exists here,
      but not all versions of gcc realize it.  Initialize to 0 to remove the
      warning.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      b4201cc4
    • B
      mac80211: mesh: fix crash in mesh_path_timer · 74932959
      Bob Copeland 提交于
      The mesh_path_reclaim() function, called from an rcu callback, cancels
      the mesh_path_timer associated with a mesh path.  Unfortunately, this
      call can happen much later, perhaps after the hash table itself is
      destroyed.
      
      Such a situation led to the following crash in mesh_path_send_to_gates()
      when dereferencing the tbl pointer:
      
      [   23.901661] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      [   23.905516] IP: [<ffffffff814c910b>] mesh_path_send_to_gates+0x2b/0x740
      [   23.908757] PGD 99ca067 PUD 99c4067 PMD 0
      [   23.910789] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
      [   23.913485] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.5.0-rc6-wt+ #43
      [   23.916675] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
      [   23.920471] task: ffffffff81685500 ti: ffffffff81678000 task.ti: ffffffff81678000
      [   23.922619] RIP: 0010:[<ffffffff814c910b>]  [<ffffffff814c910b>] mesh_path_send_to_gates+0x2b/0x740
      [   23.925237] RSP: 0018:ffff88000b403d30  EFLAGS: 00010286
      [   23.926739] RAX: 0000000000000000 RBX: ffff880009bc0d20 RCX: 0000000000000102
      [   23.928796] RDX: 000000000000002e RSI: 0000000000000001 RDI: ffff880009bc0d20
      [   23.930895] RBP: ffff88000b403e18 R08: 0000000000000001 R09: 0000000000000001
      [   23.932917] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880009c20940
      [   23.936370] R13: ffff880009bc0e70 R14: ffff880009c21c40 R15: ffff880009bc0d20
      [   23.939823] FS:  0000000000000000(0000) GS:ffff88000b400000(0000) knlGS:0000000000000000
      [   23.943688] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [   23.946429] CR2: 0000000000000008 CR3: 00000000099c5000 CR4: 00000000000006b0
      [   23.949861] Stack:
      [   23.950840]  000000000000002e ffff880009c20940 ffff88000b403da8 ffffffff8109e551
      [   23.954467]  ffffffff82711be2 000000000000002e 0000000000000000 ffffffff8166a5f5
      [   23.958141]  0000000000685ce8 0000000000000246 ffff880009bc0d20 ffff880009c20940
      [   23.961801] Call Trace:
      [   23.962987]  <IRQ>
      [   23.963963]  [<ffffffff8109e551>] ? vprintk_emit+0x351/0x5e0
      [   23.966782]  [<ffffffff8109e8ff>] ? vprintk_default+0x1f/0x30
      [   23.969529]  [<ffffffff810ffa41>] ? printk+0x48/0x50
      [   23.971956]  [<ffffffff814ceef3>] mesh_path_timer+0x133/0x160
      [   23.974707]  [<ffffffff814cedc0>] ? mesh_nexthop_resolve+0x230/0x230
      [   23.977775]  [<ffffffff810b04ee>] call_timer_fn+0xce/0x330
      [   23.980448]  [<ffffffff810b0425>] ? call_timer_fn+0x5/0x330
      [   23.983126]  [<ffffffff814cedc0>] ? mesh_nexthop_resolve+0x230/0x230
      [   23.986091]  [<ffffffff810b097c>] run_timer_softirq+0x22c/0x390
      
      Instead of cancelling in the RCU callback, set a new flag to prevent the
      timer from being rearmed, and then cancel the timer synchronously when
      freeing the mesh path.  This leaves mesh_path_reclaim() doing nothing
      but kfree, so switch to kfree_rcu().
      
      Fixes: 3b302ada7f0a ("mac80211: mesh: move path tables into if_mesh")
      Signed-off-by: NBob Copeland <me@bobcopeland.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      74932959
  22. 05 3月, 2016 1 次提交
  23. 21 10月, 2015 1 次提交
    • J
      mac80211: move station statistics into sub-structs · e5a9f8d0
      Johannes Berg 提交于
      Group station statistics by where they're (mostly) updated
      (TX, RX and TX-status) and group them into sub-structs of
      the struct sta_info.
      
      Also rename the variables since the grouping now makes it
      obvious where they belong.
      
      This makes it easier to identify where the statistics are
      updated in the code, and thus easier to think about them.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e5a9f8d0
  24. 17 7月, 2015 6 次提交
  25. 10 6月, 2015 2 次提交
  26. 16 7月, 2014 1 次提交
  27. 22 4月, 2014 2 次提交