1. 07 Sep, 2022 4 commits
    • Hans de Goede's avatar
      wifi: brcmfmac: Add DMI nvram filename quirk for Chuwi Hi8 Pro tablet · 7d6e30df
      Hans de Goede authored
      The Chuwi Hi8 Pro tablet contains quite generic names in the sys_vendor
      and product_name DMI strings, without this patch brcmfmac will try to load:
      "brcmfmac43430a0-sdio.Default string-Default string.txt" as nvram file
      which is way too generic.
      
      The Chuwi Hi8 Pro uses the same Ampak AP6212 module as the Chuwi Vi8 Plus
      and the nvram for the Vi8 Plus is already in linux-firmware, so point
      the new DMI nvram filename quirk to the Vi8 Plus nvram file.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220810142333.141044-1-hdegoede@redhat.com
      7d6e30df
    • Hans de Goede's avatar
      wifi: brcmfmac: Use ISO3166 country code and rev 0 as fallback on 43430 · d173d020
      Hans de Goede authored
      Many devices ship with a nvram ccode value of X2/XT/XU/XV/ALL which are
      all special world-wide compatibility ccode-s. Most of these world-wide
      ccode-s allow passive scan mode only for 2.4GHz channels 12-14,
      only enabling them when an AP is seen on them.
      
      Since linux-firmware has moved to the new cyfmac43430-sdio.bin +
      cyfmac43430-sdio.clm_blob firmware files this no longer works and
      43430 devices using e.g. an X2 ccode fail to connect to an AP on
      channel 13.
      
      Add the 43430 chip-id to the list of chips for which to use the ISO3166
      country code + rev 0 as fallback in brcmf_translate_country_code() to
      fix this.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220810142328.141030-1-hdegoede@redhat.com
      d173d020
    • Alexander Coffin's avatar
      wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() · 3f42faf6
      Alexander Coffin authored
      > ret = brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb);
      
      may be schedule, and then complete before the line
      
      > ndev->stats.tx_bytes += skb->len;
      
      [   46.912801] ==================================================================
      [   46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac]
      [   46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328
      [   46.935991]
      [   46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G           O      5.4.199-[REDACTED] #1
      [   46.947255] Hardware name: [REDACTED]
      [   46.954568] Call trace:
      [   46.957037]  dump_backtrace+0x0/0x2b8
      [   46.960719]  show_stack+0x24/0x30
      [   46.964052]  dump_stack+0x128/0x194
      [   46.967557]  print_address_description.isra.0+0x64/0x380
      [   46.972877]  __kasan_report+0x1d4/0x240
      [   46.976723]  kasan_report+0xc/0x18
      [   46.980138]  __asan_report_load4_noabort+0x18/0x20
      [   46.985027]  brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac]
      [   46.990613]  dev_hard_start_xmit+0x1bc/0xda0
      [   46.994894]  sch_direct_xmit+0x198/0xd08
      [   46.998827]  __qdisc_run+0x37c/0x1dc0
      [   47.002500]  __dev_queue_xmit+0x1528/0x21f8
      [   47.006692]  dev_queue_xmit+0x24/0x30
      [   47.010366]  neigh_resolve_output+0x37c/0x678
      [   47.014734]  ip_finish_output2+0x598/0x2458
      [   47.018927]  __ip_finish_output+0x300/0x730
      [   47.023118]  ip_output+0x2e0/0x430
      [   47.026530]  ip_local_out+0x90/0x140
      [   47.030117]  igmpv3_sendpack+0x14c/0x228
      [   47.034049]  igmpv3_send_cr+0x384/0x6b8
      [   47.037895]  igmp_ifc_timer_expire+0x4c/0x118
      [   47.042262]  call_timer_fn+0x1cc/0xbe8
      [   47.046021]  __run_timers+0x4d8/0xb28
      [   47.049693]  run_timer_softirq+0x24/0x40
      [   47.053626]  __do_softirq+0x2c0/0x117c
      [   47.057387]  irq_exit+0x2dc/0x388
      [   47.060715]  __handle_domain_irq+0xb4/0x158
      [   47.064908]  gic_handle_irq+0x58/0xb0
      [   47.068581]  el0_irq_naked+0x50/0x5c
      [   47.072162]
      [   47.073665] Allocated by task 328:
      [   47.077083]  save_stack+0x24/0xb0
      [   47.080410]  __kasan_kmalloc.isra.0+0xc0/0xe0
      [   47.084776]  kasan_slab_alloc+0x14/0x20
      [   47.088622]  kmem_cache_alloc+0x15c/0x468
      [   47.092643]  __alloc_skb+0xa4/0x498
      [   47.096142]  igmpv3_newpack+0x158/0xd78
      [   47.099987]  add_grhead+0x210/0x288
      [   47.103485]  add_grec+0x6b0/0xb70
      [   47.106811]  igmpv3_send_cr+0x2e0/0x6b8
      [   47.110657]  igmp_ifc_timer_expire+0x4c/0x118
      [   47.115027]  call_timer_fn+0x1cc/0xbe8
      [   47.118785]  __run_timers+0x4d8/0xb28
      [   47.122457]  run_timer_softirq+0x24/0x40
      [   47.126389]  __do_softirq+0x2c0/0x117c
      [   47.130142]
      [   47.131643] Freed by task 180:
      [   47.134712]  save_stack+0x24/0xb0
      [   47.138041]  __kasan_slab_free+0x108/0x180
      [   47.142146]  kasan_slab_free+0x10/0x18
      [   47.145904]  slab_free_freelist_hook+0xa4/0x1b0
      [   47.150444]  kmem_cache_free+0x8c/0x528
      [   47.154292]  kfree_skbmem+0x94/0x108
      [   47.157880]  consume_skb+0x10c/0x5a8
      [   47.161466]  __dev_kfree_skb_any+0x88/0xa0
      [   47.165598]  brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil]
      [   47.171023]  brcmf_txfinalize+0xec/0x190 [brcmfmac]
      [   47.176016]  brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac]
      [   47.182056]  brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac]
      [   47.187568]  brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac]
      [   47.192529]  brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac]
      [   47.197859]  process_one_work+0x7fc/0x1a80
      [   47.201965]  worker_thread+0x31c/0xc40
      [   47.205726]  kthread+0x2d8/0x370
      [   47.208967]  ret_from_fork+0x10/0x18
      [   47.212546]
      [   47.214051] The buggy address belongs to the object at ffffff803f588280
      [   47.214051]  which belongs to the cache skbuff_head_cache of size 208
      [   47.227086] The buggy address is located 104 bytes inside of
      [   47.227086]  208-byte region [ffffff803f588280, ffffff803f588350)
      [   47.238814] The buggy address belongs to the page:
      [   47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0
      [   47.255007] flags: 0x10200(slab|head)
      [   47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800
      [   47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000
      [   47.274180] page dumped because: kasan: bad access detected
      [   47.279752]
      [   47.281251] Memory state around the buggy address:
      [   47.286051]  ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [   47.293277]  ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [   47.307723]                                                           ^
      [   47.314343]  ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
      [   47.321569]  ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
      [   47.328789] ==================================================================
      Signed-off-by: default avatarAlexander Coffin <alex.coffin@matician.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220808174925.3922558-1-alex.coffin@matician.com
      3f42faf6
    • Kees Cook's avatar
      wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity · 0d24201f
      Kees Cook authored
      In preparation for FORTIFY_SOURCE performing run-time destination buffer
      bounds checking for memcpy(), refactor the use of struct iwl_calib_result:
      
      - Have struct iwl_calib_result contain struct iwl_calib_cmd since
        functions expect to operate on the "data" flex array in "cmd", which
        follows the "hdr" member.
      - Switch argument passing around to use struct iwl_calib_cmd instead of
        struct iwl_calib_hdr to prepare functions to see the "data" member.
      - Change iwl_calib_set()'s "len" argument to a size_t since it is always
        unsigned and is normally receiving the output of sizeof().
      - Add an explicit length sanity check in iwl_calib_set().
      - Adjust the memcpy() to avoid copying across the now visible composite
        flex array structure.
      
      This avoids the future run-time warning:
      
        memcpy: detected field-spanning write (size 8) of single field "&res->hdr" (size 4)
      
      Cc: Luca Coelho <luciano.coelho@intel.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Cc: linux-wireless@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Reported-by: default avatarAndy Lavr <andy.lavr@gmail.com>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220901204558.2256458-1-keescook@chromium.org
      0d24201f
  2. 06 Sep, 2022 16 commits
  3. 04 Sep, 2022 1 commit
  4. 03 Sep, 2022 19 commits