1. 20 Dec, 2018 7 commits
    • Karthikeyan Periyasamy's avatar
      ath10k: fix kernel panic due to use after free · 553a7cca
      Karthikeyan Periyasamy authored
      This issue arise in a race condition between ath10k_sta_state() and
      ath10k_htt_fetch_peer_stats(), explained in below scenario
      
      Steps:
      1. In ath10k_sta_state(), arsta->tx_stats get deallocated before peer deletion
         when the station moves from IEEE80211_STA_NONE to IEEE80211_STA_NOTEXIST
         state.
      2. Meanwhile ath10k receive HTT_T2H_MSG_TYPE_PEER_STATS message.
         In ath10k_htt_fetch_peer_stats(), arsta->tx_stats get accessed after
         the peer validation check.
      
      Since arsta->tx_stats get freed before the peer deletion [1].
      ath10k_htt_fetch_peer_stats() ended up in "use after free" situation.
      
      Fixed this issue by moving the arsta->tx_stats free handling after the
      peer deletion. so that ath10k_htt_fetch_peer_stats() will not end up in
      "use after free" situation.
      
      Kernel Panic:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000286
      pgd = d8754000
      [00000286] *pgd=00000000
      Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      ...
      CPU: 0 PID: 6245 Comm: hostapd Not tainted
      task: dc44cac0 ti: d4a38000 task.ti: d4a38000
      PC is at kmem_cache_alloc+0x7c/0x114
      LR is at ath10k_sta_state+0x190/0xd58 [ath10k_core]
      pc : [<c02bdc50>]    lr : [<bf916b78>]    psr: 20000013
      sp : d4a39b88  ip : 00000000  fp : 00000001
      r10: 00000000  r9 : 1d3bc000  r8 : 00000dc0
      r7 : 000080d0  r6 : d4a38000  r5 : dd401b00  r4 : 00000286
      r3 : 00000000  r2 : d4a39ba0  r1 : 000080d0  r0 : dd401b00
      Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 10c5787d  Table: 5a75406a  DAC: 00000015
      Process hostapd (pid: 6245, stack limit = 0xd4a38238)
      Stack: (0xd4a39b88 to 0xd4a3a000)
      ...
      [<c02bdc50>] (kmem_cache_alloc) from [<bf916b78>] (ath10k_sta_state+0x190/0xd58 [ath10k_core])
      [<bf916b78>] (ath10k_sta_state [ath10k_core]) from [<bf870d4c>] (sta_info_insert_rcu+0x418/0x61c [mac80211])
      [<bf870d4c>] (sta_info_insert_rcu [mac80211]) from [<bf88634c>] (ieee80211_add_station+0xf0/0x134 [mac80211])
      [<bf88634c>] (ieee80211_add_station [mac80211]) from [<bf83f3c4>] (nl80211_new_station+0x330/0x36c [cfg80211])
      [<bf83f3c4>] (nl80211_new_station [cfg80211]) from [<bf6c4040>] (extack_doit+0x2c/0x74 [compat])
      [<bf6c4040>] (extack_doit [compat]) from [<c05c285c>] (genl_rcv_msg+0x274/0x30c)
      [<c05c285c>] (genl_rcv_msg) from [<c05c1d98>] (netlink_rcv_skb+0x58/0xac)
      [<c05c1d98>] (netlink_rcv_skb) from [<c05c25d4>] (genl_rcv+0x20/0x34)
      [<c05c25d4>] (genl_rcv) from [<c05c1750>] (netlink_unicast+0x11c/0x204)
      [<c05c1750>] (netlink_unicast) from [<c05c1be0>] (netlink_sendmsg+0x30c/0x370)
      [<c05c1be0>] (netlink_sendmsg) from [<c0587e90>] (sock_sendmsg+0x70/0x84)
      [<c0587e90>] (sock_sendmsg) from [<c058970c>] (___sys_sendmsg.part.3+0x188/0x228)
      [<c058970c>] (___sys_sendmsg.part.3) from [<c058a594>] (__sys_sendmsg+0x4c/0x70)
      [<c058a594>] (__sys_sendmsg) from [<c0208c80>] (ret_fast_syscall+0x0/0x44)
      Code: ebfffec1 e1a04000 ea00001b e5953014 (e7940003)
      ath10k_pci 0000:01:00.0: SWBA overrun on vdev 0, skipped old beacon
      
      Hardware tested: QCA9984
      Firmware tested: 10.4-3.6.0.1-00004
      
      Fixes: a904417f ("ath10k: add extended per sta tx statistics support")
      Signed-off-by: default avatarKarthikeyan Periyasamy <periyasa@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      553a7cca
    • YueHaibing's avatar
      ath10k: remove set but not used variable 'num_tdls_vifs' · bff70e5f
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_sta_state':
      drivers/net/wireless/ath/ath10k/mac.c:6238:7: warning:
       variable 'num_tdls_vifs' set but not used [-Wunused-but-set-variable]
      
      'num_tdls_vifs' not used any more after
        9a993cc1 ("ath10k: fix the logic of limiting tdls peer counts")
      
      Also, remove the single called function ath10k_mac_tdls_vifs_count
      and ath10k_mac_tdls_vifs_count_iter.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      bff70e5f
    • YueHaibing's avatar
      wil6210: remove set but not used variable 'wdev' · 3fe970e7
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/net/wireless/ath/wil6210/main.c: In function '_wil6210_disconnect':
      drivers/net/wireless/ath/wil6210/main.c:407:23: warning:
       variable 'wdev' set but not used [-Wunused-but-set-variable]
      
      It never used since commit ("e1b43407 wil6210: refactor disconnect flow")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarMaya Erez <merez@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      3fe970e7
    • Yangtao Li's avatar
      wil6210: convert to DEFINE_SHOW_ATTRIBUTE · 986b8348
      Yangtao Li authored
      Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
      Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      986b8348
    • Kyle Roeschley's avatar
      ath6kl: Use debug instead of error message when disabled · 192a986d
      Kyle Roeschley authored
      This is not an unexpected condition, so we don't need to be shouting to the
      world about it.
      Signed-off-by: default avatarKyle Roeschley <kyle.roeschley@ni.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      192a986d
    • Kyle Roeschley's avatar
      ath6kl: Fix off by one error in scan completion · 5803c128
      Kyle Roeschley authored
      When ath6kl was reworked to share code between regular and scheduled scans
      in commit 3b8ffc6a ("ath6kl: Configure probed SSID list consistently"),
      probed SSID entry changed from 1-index to 0-indexed. However,
      ath6kl_cfg80211_scan_complete_event() was missed in that change. Fix its
      indexing so that we correctly clear out the probed SSID list.
      Signed-off-by: default avatarKyle Roeschley <kyle.roeschley@ni.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      5803c128
    • Kyle Roeschley's avatar
      ath6kl: Only use match sets when firmware supports it · fb376a49
      Kyle Roeschley authored
      Commit dd45b759 ("ath6kl: Include match ssid list in scheduled scan")
      merged the probed and matched SSID lists before sending them to the
      firmware. In the process, it assumed match set support is always available
      in ath6kl_set_probed_ssids, which breaks scans for hidden SSIDs. Now, check
      that the firmware supports matching SSIDs in scheduled scans before setting
      MATCH_SSID_FLAG.
      
      Fixes: dd45b759 ("ath6kl: Include match ssid list in scheduled scan")
      Signed-off-by: default avatarKyle Roeschley <kyle.roeschley@ni.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      fb376a49
  2. 04 Dec, 2018 23 commits
  3. 03 Dec, 2018 10 commits
    • David S. Miller's avatar
      Merge branch 'udp-msg_zerocopy' · 6e360f73
      David S. Miller authored
      Willem de Bruijn says:
      
      ====================
      udp msg_zerocopy
      
      Enable MSG_ZEROCOPY for udp sockets
      
      Patch 1/3 is the main patch, a rework of RFC patch
        http://patchwork.ozlabs.org/patch/899630/
        more details in the patch commit message
      
      Patch 2/3 is an optimization to remove a branch from the UDP hot path
        and refcount_inc/refcount_dec_and_test pair when zerocopy is used.
        This used to be included in the first patch in v2.
      
      Patch 3/3 runs the already existing udp zerocopy tests
        as part of kselftest
      
      See also recent Linux Plumbers presentation
        https://linuxplumbersconf.org/event/2/contributions/106/attachments/104/128/willemdebruijn-lpc2018-udpgso-presentation-20181113.pdf
      
      Changes:
        v1 -> v2
          - Fixup reverse christmas tree violation
        v2 -> v3
          - Split refcount avoidance optimization into separate patch
            - Fix refcount leak on error in fragmented case
              (thanks to Paolo Abeni for pointing this one out!)
            - Fix refcount inc on zero
        v3 -> v4
          - Move skb_zcopy_set below the only kfree_skb that might cause
            a premature uarg destroy before skb_zerocopy_put_abort
            - Move the entire skb_shinfo assignment block, to keep that
      	cacheline access in one place
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6e360f73
    • Willem de Bruijn's avatar
      selftests: extend zerocopy tests to udp · db63e489
      Willem de Bruijn authored
      Both msg_zerocopy and udpgso_bench have udp zerocopy variants.
      Exercise these as part of the standard kselftest run.
      
      With udp, msg_zerocopy has no control channel. Ensure that the
      receiver exits after the sender by accounting for the initial
      delay in starting them (in msg_zerocopy.sh).
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      db63e489
    • Willem de Bruijn's avatar
      udp: elide zerocopy operation in hot path · 52900d22
      Willem de Bruijn authored
      With MSG_ZEROCOPY, each skb holds a reference to a struct ubuf_info.
      Release of its last reference triggers a completion notification.
      
      The TCP stack in tcp_sendmsg_locked holds an extra ref independent of
      the skbs, because it can build, send and free skbs within its loop,
      possibly reaching refcount zero and freeing the ubuf_info too soon.
      
      The UDP stack currently also takes this extra ref, but does not need
      it as all skbs are sent after return from __ip(6)_append_data.
      
      Avoid the extra refcount_inc and refcount_dec_and_test, and generally
      the sock_zerocopy_put in the common path, by passing the initial
      reference to the first skb.
      
      This approach is taken instead of initializing the refcount to 0, as
      that would generate error "refcount_t: increment on 0" on the
      next skb_zcopy_set.
      
      Changes
        v3 -> v4
          - Move skb_zcopy_set below the only kfree_skb that might cause
            a premature uarg destroy before skb_zerocopy_put_abort
            - Move the entire skb_shinfo assignment block, to keep that
              cacheline access in one place
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52900d22
    • Willem de Bruijn's avatar
      udp: msg_zerocopy · b5947e5d
      Willem de Bruijn authored
      Extend zerocopy to udp sockets. Allow setting sockopt SO_ZEROCOPY and
      interpret flag MSG_ZEROCOPY.
      
      This patch was previously part of the zerocopy RFC patchsets. Zerocopy
      is not effective at small MTU. With segmentation offload building
      larger datagrams, the benefit of page flipping outweights the cost of
      generating a completion notification.
      
      tools/testing/selftests/net/msg_zerocopy.sh after applying follow-on
      test patch and making skb_orphan_frags_rx same as skb_orphan_frags:
      
          ipv4 udp -t 1
          tx=191312 (11938 MB) txc=0 zc=n
          rx=191312 (11938 MB)
          ipv4 udp -z -t 1
          tx=304507 (19002 MB) txc=304507 zc=y
          rx=304507 (19002 MB)
          ok
          ipv6 udp -t 1
          tx=174485 (10888 MB) txc=0 zc=n
          rx=174485 (10888 MB)
          ipv6 udp -z -t 1
          tx=294801 (18396 MB) txc=294801 zc=y
          rx=294801 (18396 MB)
          ok
      
      Changes
        v1 -> v2
          - Fixup reverse christmas tree violation
        v2 -> v3
          - Split refcount avoidance optimization into separate patch
            - Fix refcount leak on error in fragmented case
              (thanks to Paolo Abeni for pointing this one out!)
            - Fix refcount inc on zero
            - Test sock_flag SOCK_ZEROCOPY directly in __ip_append_data.
              This is needed since commit 5cf4a853 ("tcp: really ignore
      	MSG_ZEROCOPY if no SO_ZEROCOPY") did the same for tcp.
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5947e5d
    • David S. Miller's avatar
      Merge tag 'wireless-drivers-next-for-davem-2018-11-30' of... · ce01a56b
      David S. Miller authored
      Merge tag 'wireless-drivers-next-for-davem-2018-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
      
      Kalle Valo says:
      
      ====================
      wireless-drivers-next patches for 4.21
      
      First set of patches for 4.21. Most notable here is support for
      Quantenna's QSR1000/QSR2000 chipsets and more flexible ways to provide
      nvram files for brcmfmac.
      
      Major changes:
      
      brcmfmac
      
      * add support for first trying to get a board specific nvram file
      
      * add support for getting nvram contents from EFI variables
      
      qtnfmac
      
      * use single PCIe driver for all platforms and rename
        Kconfig option CONFIG_QTNFMAC_PEARL_PCIE to CONFIG_QTNFMAC_PCIE
      
      * add support for QSR1000/QSR2000 (Topaz) family of chipsets
      
      ath10k
      
      * add support for WCN3990 firmware crash recovery
      
      * add firmware memory dump support for QCA4019
      
      wil6210
      
      * add firmware error recovery while in AP mode
      
      ath9k
      
      * remove experimental notice from dynack feature
      
      iwlwifi
      
      * PCI IDs for some new 9000-series cards
      
      * improve antenna usage on connection problems
      
      * new firmware debugging infrastructure
      
      * some more work on 802.11ax
      
      * improve support for multiple RF modules with 22000 devices
      
      cordic
      
      * move cordic macros and defines to a public header file
      
      * convert brcmsmac and b43 to fully use cordic library
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce01a56b
    • David S. Miller's avatar
      Merge branch 'davinci_emac-read-the-MAC-address-from-nvmem' · 37a0bc39
      David S. Miller authored
      Bartosz Golaszewski says:
      
      ====================
      davinci_emac: read the MAC address from nvmem
      
      This series is part of a bigger series that aims at removing the platform
      data structure from the at24 EEPROM driver[1].
      
      We provide a generalized version of of_get_nvmem_mac_address(), switch the
      only user of the of_ variant to using it, remove the previous
      implementation and use the new routine in the davinci_emac driver.
      
      [1] https://lkml.org/lkml/2018/11/13/884
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      37a0bc39
    • Bartosz Golaszewski's avatar
      net: davinci_emac: use nvmem_get_mac_address() · 18dbfc81
      Bartosz Golaszewski authored
      All DaVinci boards still supported in board files now define nvmem
      cells containing the MAC address. We want to stop using the setup
      callback from at24 so the MAC address for those users will no longer
      be provided over platform data. If we didn't get a valid MAC in pdata,
      try nvmem before resorting to a random MAC.
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18dbfc81
    • Bartosz Golaszewski's avatar
      of: net: kill of_get_nvmem_mac_address() · afa64a72
      Bartosz Golaszewski authored
      We've switched all users to nvmem_get_mac_address(). Remove the now
      dead code.
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      afa64a72
    • Bartosz Golaszewski's avatar
      net: cadence: switch to using nvmem_get_mac_address() · cce41b8f
      Bartosz Golaszewski authored
      We now have a generalized helper routine to read the MAC address from
      nvmem which takes struct device as argument. The nvmem subsystem will
      then try device tree first before all other potential providers.
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cce41b8f
    • Bartosz Golaszewski's avatar
      net: ethernet: provide nvmem_get_mac_address() · 0e839df9
      Bartosz Golaszewski authored
      We already have of_get_nvmem_mac_address() but some non-DT systems want
      to read the MAC address from NVMEM too. Implement a generalized routine
      that takes struct device as argument.
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e839df9