1. 08 Feb, 2024 34 commits
  2. 06 Feb, 2024 6 commits
    • Martin Kaistra's avatar
      wifi: rtl8xxxu: update rate mask per sta · 94dd7ce1
      Martin Kaistra authored
      Until now, rtl8xxxu_watchdog_callback() only fetches RSSI and updates
      the rate mask in station mode. This means, in AP mode only the default
      rate mask is used.
      
      In order to have the rate mask reflect the actual connection quality,
      extend rtl8xxxu_watchdog_callback() to iterate over every sta. Like in
      the rtw88 driver, add a function to collect all currently present stas
      and then iterate over a list of copies to ensure no RCU lock problems
      for register access via USB. Remove the existing RCU lock in
      rtl8xxxu_refresh_rate_mask().
      
      Since the currently used ieee80211_ave_rssi() is only for 'vif', add
      driver-level tracking of RSSI per sta.
      Signed-off-by: default avatarMartin Kaistra <martin.kaistra@linutronix.de>
      Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://msgid.link/20240205093040.1941140-1-martin.kaistra@linutronix.de
      94dd7ce1
    • Ricardo B. Marliere's avatar
      bcma: make bcma_bus_type const · 06b5b294
      Ricardo B. Marliere authored
      Now that the driver core can properly handle constant struct bus_type,
      move the bcma_bus_type variable to be a constant structure as well,
      placing it into read-only memory which can not be modified at runtime.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarRicardo B. Marliere <ricardo@marliere.net>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://msgid.link/20240204-bus_cleanup-bcma-v1-1-0d881c793190@marliere.net
      06b5b294
    • Ricardo B. Marliere's avatar
      ssb: make ssb_bustype const · 78092e68
      Ricardo B. Marliere authored
      Now that the driver core can properly handle constant struct bus_type,
      move the ssb_bustype variable to be a constant structure as well,
      placing it into read-only memory which can not be modified at runtime.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarRicardo B. Marliere <ricardo@marliere.net>
      Acked-by: default avatarMichael Büsch <m@bues.ch>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://msgid.link/20240204-bus_cleanup-ssb-v1-1-511026cd5f3c@marliere.net
      78092e68
    • Jérôme Pouiller's avatar
      wifi: wfx: fix memory leak when starting AP · b8cfb7c8
      Jérôme Pouiller authored
      Kmemleak reported this error:
      
          unreferenced object 0xd73d1180 (size 184):
            comm "wpa_supplicant", pid 1559, jiffies 13006305 (age 964.245s)
            hex dump (first 32 bytes):
              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
              00 00 00 00 00 00 00 00 1e 00 01 00 00 00 00 00  ................
            backtrace:
              [<5ca11420>] kmem_cache_alloc+0x20c/0x5ac
              [<127bdd74>] __alloc_skb+0x144/0x170
              [<fb8a5e38>] __netdev_alloc_skb+0x50/0x180
              [<0f9fa1d5>] __ieee80211_beacon_get+0x290/0x4d4 [mac80211]
              [<7accd02d>] ieee80211_beacon_get_tim+0x54/0x18c [mac80211]
              [<41e25cc3>] wfx_start_ap+0xc8/0x234 [wfx]
              [<93a70356>] ieee80211_start_ap+0x404/0x6b4 [mac80211]
              [<a4a661cd>] nl80211_start_ap+0x76c/0x9e0 [cfg80211]
              [<47bd8b68>] genl_rcv_msg+0x198/0x378
              [<453ef796>] netlink_rcv_skb+0xd0/0x130
              [<6b7c977a>] genl_rcv+0x34/0x44
              [<66b2d04d>] netlink_unicast+0x1b4/0x258
              [<f965b9b6>] netlink_sendmsg+0x1e8/0x428
              [<aadb8231>] ____sys_sendmsg+0x1e0/0x274
              [<d2b5212d>] ___sys_sendmsg+0x80/0xb4
              [<69954f45>] __sys_sendmsg+0x64/0xa8
          unreferenced object 0xce087000 (size 1024):
            comm "wpa_supplicant", pid 1559, jiffies 13006305 (age 964.246s)
            hex dump (first 32 bytes):
              00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
              10 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00  ...@............
            backtrace:
              [<9a993714>] __kmalloc_track_caller+0x230/0x600
              [<f83ea192>] kmalloc_reserve.constprop.0+0x30/0x74
              [<a2c61343>] __alloc_skb+0xa0/0x170
              [<fb8a5e38>] __netdev_alloc_skb+0x50/0x180
              [<0f9fa1d5>] __ieee80211_beacon_get+0x290/0x4d4 [mac80211]
              [<7accd02d>] ieee80211_beacon_get_tim+0x54/0x18c [mac80211]
              [<41e25cc3>] wfx_start_ap+0xc8/0x234 [wfx]
              [<93a70356>] ieee80211_start_ap+0x404/0x6b4 [mac80211]
              [<a4a661cd>] nl80211_start_ap+0x76c/0x9e0 [cfg80211]
              [<47bd8b68>] genl_rcv_msg+0x198/0x378
              [<453ef796>] netlink_rcv_skb+0xd0/0x130
              [<6b7c977a>] genl_rcv+0x34/0x44
              [<66b2d04d>] netlink_unicast+0x1b4/0x258
              [<f965b9b6>] netlink_sendmsg+0x1e8/0x428
              [<aadb8231>] ____sys_sendmsg+0x1e0/0x274
              [<d2b5212d>] ___sys_sendmsg+0x80/0xb4
      
      However, since the kernel is build optimized, it seems the stack is not
      accurate. It appears the issue is related to wfx_set_mfp_ap(). The issue
      is obvious in this function: memory allocated by ieee80211_beacon_get()
      is never released. Fixing this leak makes kmemleak happy.
      Reported-by: default avatarUlrich Mohr <u.mohr@semex-engcon.com>
      Co-developed-by: default avatarUlrich Mohr <u.mohr@semex-engcon.com>
      Signed-off-by: default avatarUlrich Mohr <u.mohr@semex-engcon.com>
      Fixes: 268bceec ("staging: wfx: fix BA when device is AP and MFP is enabled")
      Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://msgid.link/20240202164213.1606145-1-jerome.pouiller@silabs.com
      b8cfb7c8
    • Ping-Ke Shih's avatar
      wifi: rtw89: fw: download firmware with key data for secure boot · 43f8a4dc
      Ping-Ke Shih authored
      Since firmware header contains multiple secure sections, we need to trim
      ignored sections, and then download firmware header with single one secure
      section.
      
      For secure boot, when downloading secure section, copy security key data
      from MSS poll by key_idx read from efuse. If non-secure boot, no need this
      extra copy.
      
                 +---------------------------+ -\
                 |      firmware header      |  |
                 |                           |  |
                 | +-----------------------+ |  | only preserve single one secure
                 | | section type/size * N | |  | section
                 | | ...                   | |  |
                 | +-----------------------+ |  |
                 +---------------------------+ -/
                 :                           :
                 +---------------------------+ -\
                 | secure section type (ID:9)|  |
                 |                           |  |
            +----|-> [ security key data ]   |  |
            |    +---------------------------+ -/
            |    |MSS Pool for above section |
            |    |  [ security key data 0 ]  |
            +----|- [ security key data 1 ]  |
      by key_idx |  [ security key data 2 ]  |
                 |  ...                      |
                 +---------------------------+
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://msgid.link/20240204012627.9647-5-pkshih@realtek.com
      43f8a4dc
    • Ping-Ke Shih's avatar
      wifi: rtw89: fw: parse secure section from firmware file · 12ff5e1c
      Ping-Ke Shih authored
      A firmware file can contains more than one section with secure type, so
      use secure information from efuse to choose the one with matched
      cryptography method. Then choose key data from MSS poll (multiple security
      section pool; see below picture) according to key_index from efuse.
      
      Note that the size of MSS pool isn't included in section size defined
      in firmware header, so we also need to parse header of MSS pool to get
      its size as shift to parse next section.
      
      If secure boot isn't supported by current hardware, the first secure
      section will be adopted, and no need additional process to key data.
      
        +---------------------------+
        |      firmware header      |
        |                           |
        | +-----------------------+ |
        | | section type/size * N-|-|-------+
        | | ...                   | |       |
        | +-----------------------+ |       |
        +---------------------------+       |
        :                           :       |
        +---------------------------+ -\    |
        | secure section type (ID:9)|  |    |
        |                           |  | <--+
        |                           |  |
        +---------------------------+ -/
        |MSS Pool for above section |
        |                           |
        |                           |
        +---------------------------+
      Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://msgid.link/20240204012627.9647-4-pkshih@realtek.com
      12ff5e1c