1. 19 2月, 2019 1 次提交
  2. 08 2月, 2019 1 次提交
  3. 13 12月, 2018 1 次提交
    • A
      brcmfmac: fix false-positive -Wmaybe-unintialized warning · 412dd15c
      Arnd Bergmann 提交于
      When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
      for the brcmf_fw_request_nvram_done() function, after gcc figures
      out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
      variable, but fails to notice that it always returns NULL:
      
      drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
      drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      Mark it 'inline' to force gcc to understand this.
      
      Fixes: ce2e6db5 ("brcmfmac: Add support for getting nvram contents from EFI variables")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      412dd15c
  4. 29 11月, 2018 1 次提交
    • L
      brcmfmac: Fix out of bounds memory access during fw load · b72c51a5
      Lyude Paul 提交于
      I ended up tracking down some rather nasty issues with f2fs (and other
      filesystem modules) constantly crashing on my kernel down to a
      combination of out of bounds memory accesses, one of which was coming
      from brcmfmac during module load:
      
      [   30.891382] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4356-sdio for chip BCM4356/2
      [   30.894437] ==================================================================
      [   30.901581] BUG: KASAN: global-out-of-bounds in brcmf_fw_alloc_request+0x42c/0x480 [brcmfmac]
      [   30.909935] Read of size 1 at addr ffff2000024865df by task kworker/6:2/387
      [   30.916805]
      [   30.918261] CPU: 6 PID: 387 Comm: kworker/6:2 Tainted: G           O      4.20.0-rc3Lyude-Test+ #19
      [   30.927251] Hardware name: amlogic khadas-vim2/khadas-vim2, BIOS 2018.07-rc2-armbian 09/11/2018
      [   30.935964] Workqueue: events brcmf_driver_register [brcmfmac]
      [   30.941641] Call trace:
      [   30.944058]  dump_backtrace+0x0/0x3e8
      [   30.947676]  show_stack+0x14/0x20
      [   30.950968]  dump_stack+0x130/0x1c4
      [   30.954406]  print_address_description+0x60/0x25c
      [   30.959066]  kasan_report+0x1b4/0x368
      [   30.962683]  __asan_report_load1_noabort+0x18/0x20
      [   30.967547]  brcmf_fw_alloc_request+0x42c/0x480 [brcmfmac]
      [   30.967639]  brcmf_sdio_probe+0x163c/0x2050 [brcmfmac]
      [   30.978035]  brcmf_ops_sdio_probe+0x598/0xa08 [brcmfmac]
      [   30.983254]  sdio_bus_probe+0x190/0x398
      [   30.983270]  really_probe+0x2a0/0xa70
      [   30.983296]  driver_probe_device+0x1b4/0x2d8
      [   30.994901]  __driver_attach+0x200/0x280
      [   30.994914]  bus_for_each_dev+0x10c/0x1a8
      [   30.994925]  driver_attach+0x38/0x50
      [   30.994935]  bus_add_driver+0x330/0x608
      [   30.994953]  driver_register+0x140/0x388
      [   31.013965]  sdio_register_driver+0x74/0xa0
      [   31.014076]  brcmf_sdio_register+0x14/0x60 [brcmfmac]
      [   31.023177]  brcmf_driver_register+0xc/0x18 [brcmfmac]
      [   31.023209]  process_one_work+0x654/0x1080
      [   31.032266]  worker_thread+0x4f0/0x1308
      [   31.032286]  kthread+0x2a8/0x320
      [   31.039254]  ret_from_fork+0x10/0x1c
      [   31.039269]
      [   31.044226] The buggy address belongs to the variable:
      [   31.044351]  brcmf_firmware_path+0x11f/0xfffffffffffd3b40 [brcmfmac]
      [   31.055601]
      [   31.057031] Memory state around the buggy address:
      [   31.061800]  ffff200002486480: 04 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
      [   31.068983]  ffff200002486500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   31.068993] >ffff200002486580: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
      [   31.068999]                                                     ^
      [   31.069017]  ffff200002486600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   31.096521]  ffff200002486680: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
      [   31.096528] ==================================================================
      [   31.096533] Disabling lock debugging due to kernel taint
      
      It appears that when trying to determine the length of the string in the
      alternate firmware path, we make the mistake of not handling the case
      where the firmware path is empty correctly. Since strlen(mp_path) can
      return 0, we'll end up accessing mp_path[-1] when the firmware_path
      isn't provided through the module arguments.
      
      So, fix this by just setting the end char to '\0' by default, and only
      changing it if we have a non-zero length. Additionally, use strnlen()
      with BRCMF_FW_ALTPATH_LEN instead of strlen() just to be extra safe.
      
      Fixes: 2baa3aae ("brcmfmac: introduce brcmf_fw_alloc_request() function")
      Cc: Hante Meuleman <hante.meuleman@broadcom.com>
      Cc: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
      Cc: Franky Lin <franky.lin@broadcom.com>
      Cc: Arend van Spriel <arend.vanspriel@broadcom.com>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Arend Van Spriel <arend.vanspriel@broadcom.com>
      Cc: Himanshu Jha <himanshujha199640@gmail.com>
      Cc: Dan Haab <dhaab@luxul.com>
      Cc: Jia-Shyr Chuang <saint.chuang@cypress.com>
      Cc: Ian Molton <ian@mnementh.co.uk>
      Cc: <stable@vger.kernel.org> # v4.17+
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      b72c51a5
  5. 07 11月, 2018 6 次提交
    • H
      brcmfmac: Fix ccode from EFI nvram when necessary · 29ec3394
      Hans de Goede 提交于
      In some cases the EFI-var stored nvram contains "ccode=ALL" or "ccode=XV"
      to specify "worldwide" compatible settings, but these 2 ccode-s do not work
      properly.
      
      I've tested the different known "worldwide" ccode-s used in various nvram
      sources with the latest firmwares from linux-firmware for various brcmfmac
      models, here is a simplified (*) table with what each setting results in:
      
      ALL: 12-14 disab, U-NII-1, U-NII-2 no-IR/radar, U-NII-3
      XV:  12-14 no-IR, disables all 5G channels
      XY:  12-13 enab, 14 disab, U-NII-1 enab, U-NII-2 no-IR/radar, U-NII-3 disab
      X2:  12-13 no-IR, 14 dis, U-NII-1 no-IR, U-NII-2 no-IR/radar, U-NII-3 no-IR
      
      Where 12,13,14 are 2.4G channels 12-14 and U-NII-1/2/3 are the 3 different
      5G channel groups. no-IR is no-Initiate-Radiation, we will never send on
      these channels without first having received valid wifi traffic there.
      
      This immediately shows that both ALL and XV are not as worldwide as we want
      them to be. ALL causes channels 12 and 13 to not be available and XV causes
      all 5GHz channels to not be available. Also ALL unconditionally enables the
      U-NII-1 and U-NII-3 5G groups, while we really should be using no-IR for
      these.
      
      This commit replace XV and ALL with X2, which allows usage of chan 12-13
      and 5G channels, but only after receiving valid wifi traffic there first.
      
      Note that this configure the firmware's channel limits, the kernels own
      regulatory restrictions based on e.g. regulatory info received from the
      access-point, will be applied on top of this.
      
      This fixes channels 12+13 not working on the Asus T200TA and the Lenovo
      Mixx 2 8 and 5G channels not working on the Asus T100HA.
      
      This has been tested on the following models: Acer Iconia Tab8 w1-810,
      Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a
      Lenovo Mixx 2 8.
      
      *) There are some exceptions to this table:
      1) On really old firmware e.g. linux-firmware's 2011 brcmfmac4330-sdio.bin
         ALL really means all, unconditionally enabling everything
      2) The exact meaning might be influenced by setting the regrev nvram var.
         Specifically using ccode=XV + regrev=1 on brcmfmac43241b4 leads to:
         12-14 no-ir, U-NII-1 no-ir, U-NII-2 no-ir/radar, U-NII-3 no-ir
         But only on the brcmfmac43241b4 and not on e.g. the brcmfmac43340
      Tested-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      29ec3394
    • H
      brcmfmac: Add support for getting nvram contents from EFI variables · ce2e6db5
      Hans de Goede 提交于
      Various X86 laptops with a SDIO attached brcmfmac wifi chip, store the
      nvram contents in a special EFI variable. This commit adds support for
      getting nvram directly from this EFI variable, without the user needing
      to manually copy it.
      
      This makes Wifi / Bluetooth work out of the box on these devices instead of
      requiring manual setup.
      
      This has been tested on the following models: Acer Iconia Tab8 w1-810,
      Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a
      Lenovo Mixx 2 8.
      Tested-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      ce2e6db5
    • H
      brcmfmac: Cleanup brcmf_fw_request_done() · 55e491ed
      Hans de Goede 提交于
      The "cur" variable is now only used for a debug print and we already
      print the same info from brcmf_fw_complete_request(), so the debug print
      does not provide any extra info and we can remove it.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      55e491ed
    • H
      brcmfmac: Add support for first trying to get a board specific nvram file · eae8e506
      Hans de Goede 提交于
      The nvram files which some brcmfmac chips need are board-specific. To be
      able to distribute these as part of linux-firmware, so that devices with
      such a wifi chip will work OOTB, multiple (one per board) versions must
      co-exist under /lib/firmware.
      
      This commit adds support for callers of the brcmfmac/firmware.c code to
      pass in a board_type parameter through the request structure.
      
      If that parameter is set then the code will first try to load
      chipmodel.board_type.txt before falling back to the old chipmodel.txt name.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      eae8e506
    • H
      brcmfmac: Remove recursion from firmware load error handling · 5b587496
      Hans de Goede 提交于
      Before this commit brcmf_fw_request_done would call
      brcmf_fw_request_next_item to load the next item, which on an error would
      call brcmf_fw_request_done, which if the error is recoverable (*) will
      then continue calling brcmf_fw_request_next_item for the next item again
      which on an error will call brcmf_fw_request_done again...
      
      This does not blow up because we only have a limited number of items so
      we never recurse too deep. But the recursion is still quite ugly and
      frankly is giving me a headache, so lets fix this.
      
      This commit fixes this by removing brcmf_fw_request_next_item and by
      making brcmf_fw_get_firmwares and brcmf_fw_request_done directly call
      firmware_request_nowait resp. firmware_request themselves.
      
      *) brcmf_fw_request_nvram_done fallback path succeeds or
         BRCMF_FW_REQF_OPTIONAL is set
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      5b587496
    • H
      brcmfmac: Remove firmware-loading code duplication · a1a3b762
      Hans de Goede 提交于
      brcmf_fw_request_next_item and brcmf_fw_request_done both have identical
      code to complete the fw-request depending on the item-type.
      
      This commit adds a new brcmf_fw_complete_request helper removing this code
      duplication.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      a1a3b762
  6. 30 4月, 2018 1 次提交
  7. 09 4月, 2018 1 次提交
  8. 27 3月, 2018 6 次提交
  9. 31 8月, 2017 1 次提交
  10. 16 6月, 2017 2 次提交
  11. 14 4月, 2016 1 次提交
  12. 06 2月, 2016 1 次提交
    • R
      brcmfmac: treat NULL character in NVRAM as separator · d1e61b86
      Rafał Miłecki 提交于
      Platform NVRAM (stored on a flash partition) has entries separated by a
      NULL (\0) char. Our parsing code switches from VALUE state to IDLE
      whenever it meets a NULL (\0). When that happens our IDLE handler should
      simply consume it and analyze whatever is placed ahead.
      
      This fixes harmless warnings spamming debugging output:
      [  155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
      [  155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
      [  155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
      Signed-off-by: NRafał Miłecki <zajec5@gmail.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      d1e61b86
  13. 07 1月, 2016 1 次提交
  14. 30 11月, 2015 1 次提交
  15. 26 11月, 2015 1 次提交
  16. 18 11月, 2015 1 次提交
  17. 21 10月, 2015 1 次提交
  18. 25 8月, 2015 1 次提交
  19. 08 6月, 2015 2 次提交
  20. 28 5月, 2015 4 次提交
  21. 09 5月, 2015 1 次提交
  22. 29 1月, 2015 1 次提交
  23. 21 11月, 2014 1 次提交
  24. 31 10月, 2014 1 次提交
  25. 16 7月, 2014 1 次提交