Skip to content
  1. Apr 03, 2024
    • Aleksandr Mishin's avatar
      octeontx2-af: Add array index check · ef15ddee
      Aleksandr Mishin authored
      In rvu_map_cgx_lmac_pf() the 'iter', which is used as an array index, can reach
      value (up to 14) that exceed the size (MAX_LMAC_COUNT = 8) of the array.
      Fix this bug by adding 'iter' value check.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: 91c6945e
      
       ("octeontx2-af: cn10k: Add RPM MAC support")
      Signed-off-by: default avatarAleksandr Mishin <amishin@t-argos.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ef15ddee
    • Tariq Toukan's avatar
      MAINTAINERS: mlx5: Add Tariq Toukan · c53fe72c
      Tariq Toukan authored
      
      
      Add myself as mlx5 core and EN maintainer.
      
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
      Acked-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Link: https://lore.kernel.org/r/20240401184347.53884-1-tariqt@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c53fe72c
    • Kuniyuki Iwashima's avatar
      ipv6: Fix infinite recursion in fib6_dump_done(). · d21d4060
      Kuniyuki Iwashima authored
      syzkaller reported infinite recursive calls of fib6_dump_done() during
      netlink socket destruction.  [1]
      
      From the log, syzkaller sent an AF_UNSPEC RTM_GETROUTE message, and then
      the response was generated.  The following recvmmsg() resumed the dump
      for IPv6, but the first call of inet6_dump_fib() failed at kzalloc() due
      to the fault injection.  [0]
      
        12:01:34 executing program 3:
        r0 = socket$nl_route(0x10, 0x3, 0x0)
        sendmsg$nl_route(r0, ... snip ...)
        recvmmsg(r0, ... snip ...) (fail_nth: 8)
      
      Here, fib6_dump_done() was set to nlk_sk(sk)->cb.done, and the next call
      of inet6_dump_fib() set it to nlk_sk(sk)->cb.args[3].  syzkaller stopped
      receiving the response halfway through, and finally netlink_sock_destruct()
      called nlk_sk(sk)->cb.done().
      
      fib6_dump_done() calls fib6_dump_end() and nlk_sk(sk)->cb.done() if it
      is still not NULL.  fib6_dump_end() rewrites nlk_sk(sk)->cb.done() by
      nlk_sk(sk)->cb.args[3], but it has the same function, not NULL, calling
      itself recursively and hitting the stack guard page.
      
      To avoid the issue, let's set the destructor after kzalloc().
      
      [0]:
      FAULT_INJECTION: forcing a failure.
      name failslab, interval 1, probability 0, space 0, times 0
      CPU: 1 PID: 432110 Comm: syz-executor.3 Not tainted 6.8.0-12821-g537c2e91d354-dirty #11
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      Call Trace:
       <TASK>
       dump_stack_lvl (lib/dump_stack.c:117)
       should_fail_ex (lib/fault-inject.c:52 lib/fault-inject.c:153)
       should_failslab (mm/slub.c:3733)
       kmalloc_trace (mm/slub.c:3748 mm/slub.c:3827 mm/slub.c:3992)
       inet6_dump_fib (./include/linux/slab.h:628 ./include/linux/slab.h:749 net/ipv6/ip6_fib.c:662)
       rtnl_dump_all (net/core/rtnetlink.c:4029)
       netlink_dump (net/netlink/af_netlink.c:2269)
       netlink_recvmsg (net/netlink/af_netlink.c:1988)
       ____sys_recvmsg (net/socket.c:1046 net/socket.c:2801)
       ___sys_recvmsg (net/socket.c:2846)
       do_recvmmsg (net/socket.c:2943)
       __x64_sys_recvmmsg (net/socket.c:3041 net/socket.c:3034 net/socket.c:3034)
      
      [1]:
      BUG: TASK stack guard page was hit at 00000000f2fa9af1 (stack is 00000000b7912430..000000009a436beb)
      stack guard page: 0000 [#1] PREEMPT SMP KASAN
      CPU: 1 PID: 223719 Comm: kworker/1:3 Not tainted 6.8.0-12821-g537c2e91d354-dirty #11
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      Workqueue: events netlink_sock_destruct_work
      RIP: 0010:fib6_dump_done (net/ipv6/ip6_fib.c:570)
      Code: 3c 24 e8 f3 e9 51 fd e9 28 fd ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 48 89 fd <53> 48 8d 5d 60 e8 b6 4d 07 fd 48 89 da 48 b8 00 00 00 00 00 fc ff
      RSP: 0018:ffffc9000d980000 EFLAGS: 00010293
      RAX: 0000000000000000 RBX: ffffffff84405990 RCX: ffffffff844059d3
      RDX: ffff8881028e0000 RSI: ffffffff84405ac2 RDI: ffff88810c02f358
      RBP: ffff88810c02f358 R08: 0000000000000007 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000224 R12: 0000000000000000
      R13: ffff888007c82c78 R14: ffff888007c82c68 R15: ffff888007c82c68
      FS:  0000000000000000(0000) GS:ffff88811b100000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffc9000d97fff8 CR3: 0000000102309002 CR4: 0000000000770ef0
      PKRU: 55555554
      Call Trace:
       <#DF>
       </#DF>
       <TASK>
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       ...
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       fib6_dump_done (net/ipv6/ip6_fib.c:572 (discriminator 1))
       netlink_sock_destruct (net/netlink/af_netlink.c:401)
       __sk_destruct (net/core/sock.c:2177 (discriminator 2))
       sk_destruct (net/core/sock.c:2224)
       __sk_free (net/core/sock.c:2235)
       sk_free (net/core/sock.c:2246)
       process_one_work (kernel/workqueue.c:3259)
       worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
       kthread (kernel/kthread.c:388)
       ret_from_fork (arch/x86/kernel/process.c:153)
       ret_from_fork_asm (arch/x86/entry/entry_64.S:256)
      Modules linked in:
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20240401211003.25274-1-kuniyu@amazon.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d21d4060
    • Heiner Kallweit's avatar
      r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d · 5d872c9f
      Heiner Kallweit authored
      On some boards with this chip version the BIOS is buggy and misses
      to reset the PHY page selector. This results in the PHY ID read
      accessing registers on a different page, returning a more or
      less random value. Fix this by resetting the page selector first.
      
      Fixes: f1e911d5
      
       ("r8169: add basic phylib support")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/64f2055e-98b8-45ec-8568-665e3d54d4e6@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5d872c9f
    • Marco Pinna's avatar
      vsock/virtio: fix packet delivery to tap device · b32a09ea
      Marco Pinna authored
      Commit 82dfb540 ("VSOCK: Add virtio vsock vsockmon hooks") added
      virtio_transport_deliver_tap_pkt() for handing packets to the
      vsockmon device. However, in virtio_transport_send_pkt_work(),
      the function is called before actually sending the packet (i.e.
      before placing it in the virtqueue with virtqueue_add_sgs() and checking
      whether it returned successfully).
      Queuing the packet in the virtqueue can fail even multiple times.
      However, in virtio_transport_deliver_tap_pkt() we deliver the packet
      to the monitoring tap interface only the first time we call it.
      This certainly avoids seeing the same packet replicated multiple times
      in the monitoring interface, but it can show the packet sent with the
      wrong timestamp or even before we succeed to queue it in the virtqueue.
      
      Move virtio_transport_deliver_tap_pkt() after calling virtqueue_add_sgs()
      and making sure it returned successfully.
      
      Fixes: 82dfb540
      
       ("VSOCK: Add virtio vsock vsockmon hooks")
      Cc: stable@vge.kernel.org
      Signed-off-by: default avatarMarco Pinna <marco.pinn95@gmail.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Link: https://lore.kernel.org/r/20240329161259.411751-1-marco.pinn95@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b32a09ea
    • Duoming Zhou's avatar
      ax25: fix use-after-free bugs caused by ax25_ds_del_timer · fd819ad3
      Duoming Zhou authored
      When the ax25 device is detaching, the ax25_dev_device_down()
      calls ax25_ds_del_timer() to cleanup the slave_timer. When
      the timer handler is running, the ax25_ds_del_timer() that
      calls del_timer() in it will return directly. As a result,
      the use-after-free bugs could happen, one of the scenarios
      is shown below:
      
            (Thread 1)          |      (Thread 2)
                                | ax25_ds_timeout()
      ax25_dev_device_down()    |
        ax25_ds_del_timer()     |
          del_timer()           |
        ax25_dev_put() //FREE   |
                                |  ax25_dev-> //USE
      
      In order to mitigate bugs, when the device is detaching, use
      timer_shutdown_sync() to stop the timer.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240329015023.9223-1-duoming@zju.edu.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fd819ad3
  2. Apr 02, 2024
  3. Mar 30, 2024
  4. Mar 29, 2024
    • David Thompson's avatar
      mlxbf_gige: stop interface during shutdown · 09ba28e1
      David Thompson authored
      The mlxbf_gige driver intermittantly encounters a NULL pointer
      exception while the system is shutting down via "reboot" command.
      The mlxbf_driver will experience an exception right after executing
      its shutdown() method.  One example of this exception is:
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070
      Mem abort info:
        ESR = 0x0000000096000004
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        FSC = 0x04: level 0 translation fault
      Data abort info:
        ISV = 0, ISS = 0x00000004
        CM = 0, WnR = 0
      user pgtable: 4k pages, 48-bit VAs, pgdp=000000011d373000
      [0000000000000070] pgd=0000000000000000, p4d=0000000000000000
      Internal error: Oops: 96000004 [#1] SMP
      CPU: 0 PID: 13 Comm: ksoftirqd/0 Tainted: G S         OE     5.15.0-bf.6.gef6992a #1
      Hardware name: https://www.mellanox.com BlueField SoC/BlueField SoC, BIOS 4.0.2.12669 Apr 21 2023
      pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige]
      lr : mlxbf_gige_poll+0x54/0x160 [mlxbf_gige]
      sp : ffff8000080d3c10
      x29: ffff8000080d3c10 x28: ffffcce72cbb7000 x27: ffff8000080d3d58
      x26: ffff0000814e7340 x25: ffff331cd1a05000 x24: ffffcce72c4ea008
      x23: ffff0000814e4b40 x22: ffff0000814e4d10 x21: ffff0000814e4128
      x20: 0000000000000000 x19: ffff0000814e4a80 x18: ffffffffffffffff
      x17: 000000000000001c x16: ffffcce72b4553f4 x15: ffff80008805b8a7
      x14: 0000000000000000 x13: 0000000000000030 x12: 0101010101010101
      x11: 7f7f7f7f7f7f7f7f x10: c2ac898b17576267 x9 : ffffcce720fa5404
      x8 : ffff000080812138 x7 : 0000000000002e9a x6 : 0000000000000080
      x5 : ffff00008de3b000 x4 : 0000000000000000 x3 : 0000000000000001
      x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
      Call trace:
       mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige]
       mlxbf_gige_poll+0x54/0x160 [mlxbf_gige]
       __napi_poll+0x40/0x1c8
       net_rx_action+0x314/0x3a0
       __do_softirq+0x128/0x334
       run_ksoftirqd+0x54/0x6c
       smpboot_thread_fn+0x14c/0x190
       kthread+0x10c/0x110
       ret_from_fork+0x10/0x20
      Code: 8b070000 f9000ea0 f95056c0 f86178a1 (b9407002)
      ---[ end trace 7cc3941aa0d8e6a4 ]---
      Kernel panic - not syncing: Oops: Fatal exception in interrupt
      Kernel Offset: 0x4ce722520000 from 0xffff800008000000
      PHYS_OFFSET: 0x80000000
      CPU features: 0x000005c1,a3330e5a
      Memory Limit: none
      ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---
      
      During system shutdown, the mlxbf_gige driver's shutdown() is always executed.
      However, the driver's stop() method will only execute if networking interface
      configuration logic within the Linux distribution has been setup to do so.
      
      If shutdown() executes but stop() does not execute, NAPI remains enabled
      and this can lead to an exception if NAPI is scheduled while the hardware
      interface has only been partially deinitialized.
      
      The networking interface managed by the mlxbf_gige driver must be properly
      stopped during system shutdown so that IFF_UP is cleared, the hardware
      interface is put into a clean state, and NAPI is fully deinitialized.
      
      Fixes: f92e1869
      
       ("Add Mellanox BlueField Gigabit Ethernet driver")
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Link: https://lore.kernel.org/r/20240325210929.25362-1-davthompson@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      09ba28e1
    • Bastien Nocera's avatar
      Bluetooth: Fix TOCTOU in HCI debugfs implementation · 7835fcfd
      Bastien Nocera authored
      struct hci_dev members conn_info_max_age, conn_info_min_age,
      le_conn_max_interval, le_conn_min_interval, le_adv_max_interval,
      and le_adv_min_interval can be modified from the HCI core code, as well
      through debugfs.
      
      The debugfs implementation, that's only available to privileged users,
      will check for boundaries, making sure that the minimum value being set
      is strictly above the maximum value that already exists, and vice-versa.
      
      However, as both minimum and maximum values can be changed concurrently
      to us modifying them, we need to make sure that the value we check is
      the value we end up using.
      
      For example, with ->conn_info_max_age set to 10, conn_info_min_age_set()
      gets called from vfs handlers to set conn_info_min_age to 8.
      
      In conn_info_min_age_set(), this goes through:
      	if (val == 0 || val > hdev->conn_info_max_age)
      		return -EINVAL;
      
      Concurrently, conn_info_max_age_set() gets called to set to set the
      conn_info_max_age to 7:
      	if (val == 0 || val > hdev->conn_info_max_age)
      		return -EINVAL;
      That check will also pass because we used the old value (10) for
      conn_info_max_age.
      
      After those checks that both passed, the struct hci_dev access
      is mutex-locked, disabling concurrent access, but that does not matter
      because the invalid value checks both passed, and we'll end up with
      conn_info_min_age = 8 and conn_info_max_age = 7
      
      To fix this problem, we need to lock the structure access before so the
      check and assignment are not interrupted.
      
      This fix was originally devised by the BassCheck[1] team, and
      considered the problem to be an atomicity one. This isn't the case as
      there aren't any concerns about the variable changing while we check it,
      but rather after we check it parallel to another change.
      
      This patch fixes CVE-2024-24858 and CVE-2024-24857.
      
      [1] https://sites.google.com/view/basscheck/
      
      
      
      Co-developed-by: default avatarGui-Dong Han <2045gemini@gmail.com>
      Signed-off-by: default avatarGui-Dong Han <2045gemini@gmail.com>
      Link: https://lore.kernel.org/linux-bluetooth/20231222161317.6255-1-2045gemini@gmail.com/
      Link: https://nvd.nist.gov/vuln/detail/CVE-2024-24858
      Link: https://lore.kernel.org/linux-bluetooth/20231222162931.6553-1-2045gemini@gmail.com/
      Link: https://lore.kernel.org/linux-bluetooth/20231222162310.6461-1-2045gemini@gmail.com/
      Link: https://nvd.nist.gov/vuln/detail/CVE-2024-24857
      Fixes: 31ad1691 ("Bluetooth: Add conn info lifetime parameters to debugfs")
      Fixes: 729a1051 ("Bluetooth: Expose default LE advertising interval via debugfs")
      Fixes: 71c3b60e
      
       ("Bluetooth: Move BR/EDR debugfs file creation into hci_debugfs.c")
      Signed-off-by: default avatarBastien Nocera <hadess@hadess.net>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7835fcfd
    • Hui Wang's avatar
      Bluetooth: hci_event: set the conn encrypted before conn establishes · c569242c
      Hui Wang authored
      We have a BT headset (Lenovo Thinkplus XT99), the pairing and
      connecting has no problem, once this headset is paired, bluez will
      remember this device and will auto re-connect it whenever the device
      is powered on. The auto re-connecting works well with Windows and
      Android, but with Linux, it always fails. Through debugging, we found
      at the rfcomm connection stage, the bluetooth stack reports
      "Connection refused - security block (0x0003)".
      
      For this device, the re-connecting negotiation process is different
      from other BT headsets, it sends the Link_KEY_REQUEST command before
      the CONNECT_REQUEST completes, and it doesn't send ENCRYPT_CHANGE
      command during the negotiation. When the device sends the "connect
      complete" to hci, the ev->encr_mode is 1.
      
      So here in the conn_complete_evt(), if ev->encr_mode is 1, link type
      is ACL and HCI_CONN_ENCRYPT is not set, we set HCI_CONN_ENCRYPT to
      this conn, and update conn->enc_key_size accordingly.
      
      After this change, this BT headset could re-connect with Linux
      successfully. This is the btmon log after applying the patch, after
      receiving the "Connect Complete" with "Encryption: Enabled", will send
      the command to read encryption key size:
      > HCI Event: Connect Request (0x04) plen 10
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
              Class: 0x240404
                Major class: Audio/Video (headset, speaker, stereo, video, vcr)
                Minor class: Wearable Headset Device
                Rendering (Printing, Speaker)
                Audio (Speaker, Microphone, Headset)
              Link type: ACL (0x01)
      ...
      > HCI Event: Link Key Request (0x17) plen 6
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
      < HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
              Link key: ${32-hex-digits-key}
      ...
      > HCI Event: Connect Complete (0x03) plen 11
              Status: Success (0x00)
              Handle: 256
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
              Link type: ACL (0x01)
              Encryption: Enabled (0x01)
      < HCI Command: Read Encryption Key... (0x05|0x0008) plen 2
              Handle: 256
      < ACL Data TX: Handle 256 flags 0x00 dlen 10
            L2CAP: Information Request (0x0a) ident 1 len 2
              Type: Extended features supported (0x0002)
      > HCI Event: Command Complete (0x0e) plen 7
            Read Encryption Key Size (0x05|0x0008) ncmd 1
              Status: Success (0x00)
              Handle: 256
              Key size: 16
      
      Cc: stable@vger.kernel.org
      Link: https://github.com/bluez/bluez/issues/704
      
      
      Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Reviewed-by: default avatarLuiz Augusto von Dentz <luiz.dentz@gmail.com>
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      c569242c
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Fix not checking error on hci_cmd_sync_cancel_sync · 6946b9c9
      Luiz Augusto von Dentz authored
      hci_cmd_sync_cancel_sync shall check the error passed to it since it
      will be propagated using req_result which is __u32 it needs to be
      properly set to a positive value if it was passed as negative othertise
      IS_ERR will not trigger as -(errno) would be converted to a positive
      value.
      
      Fixes: 63298d6e
      
       ("Bluetooth: hci_core: Cancel request on command timeout")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Reported-and-tested-by: default avatarThorsten Leemhuis <linux@leemhuis.info>
      Closes: https://lore.kernel.org/all/08275279-7462-4f4a-a0ee-8aa015f829bc@leemhuis.info/
      6946b9c9
    • Johan Hovold's avatar
      Bluetooth: qca: fix device-address endianness · 77f45cca
      Johan Hovold authored
      The WCN6855 firmware on the Lenovo ThinkPad X13s expects the Bluetooth
      device address in big-endian order when setting it using the
      EDL_WRITE_BD_ADDR_OPCODE command.
      
      Presumably, this is the case for all non-ROME devices which all use the
      EDL_WRITE_BD_ADDR_OPCODE command for this (unlike the ROME devices which
      use a different command and expect the address in little-endian order).
      
      Reverse the little-endian address before setting it to make sure that
      the address can be configured using tools like btmgmt or using the
      'local-bd-address' devicetree property.
      
      Note that this can potentially break systems with boot firmware which
      has started relying on the broken behaviour and is incorrectly passing
      the address via devicetree in big-endian order.
      
      The only device affected by this should be the WCN3991 used in some
      Chromebooks. As ChromeOS updates the kernel and devicetree in lockstep,
      the new 'qcom,local-bd-address-broken' property can be used to determine
      if the firmware is buggy so that the underlying driver bug can be fixed
      without breaking backwards compatibility.
      
      Set the HCI_QUIRK_BDADDR_PROPERTY_BROKEN quirk for such platforms so
      that the address is reversed when parsing the address property.
      
      Fixes: 5c0a1001
      
       ("Bluetooth: hci_qca: Add helper to set device address")
      Cc: stable@vger.kernel.org      # 5.1
      Cc: Balakrishna Godavarthi <quic_bgodavar@quicinc.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Tested-by: Nikita Travkin <nikita@trvn.ru> # sc7180
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      77f45cca
    • Johan Hovold's avatar
      Bluetooth: add quirk for broken address properties · 39646f29
      Johan Hovold authored
      Some Bluetooth controllers lack persistent storage for the device
      address and instead one can be provided by the boot firmware using the
      'local-bd-address' devicetree property.
      
      The Bluetooth devicetree bindings clearly states that the address should
      be specified in little-endian order, but due to a long-standing bug in
      the Qualcomm driver which reversed the address some boot firmware has
      been providing the address in big-endian order instead.
      
      Add a new quirk that can be set on platforms with broken firmware and
      use it to reverse the address when parsing the property so that the
      underlying driver bug can be fixed.
      
      Fixes: 5c0a1001
      
       ("Bluetooth: hci_qca: Add helper to set device address")
      Cc: stable@vger.kernel.org      # 5.1
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      39646f29
    • Johan Hovold's avatar
      arm64: dts: qcom: sc7180-trogdor: mark bluetooth address as broken · e12e2800
      Johan Hovold authored
      Several Qualcomm Bluetooth controllers lack persistent storage for the
      device address and instead one can be provided by the boot firmware
      using the 'local-bd-address' devicetree property.
      
      The Bluetooth bindings clearly states that the address should be
      specified in little-endian order, but due to a long-standing bug in the
      Qualcomm driver which reversed the address some boot firmware has been
      providing the address in big-endian order instead.
      
      The boot firmware in SC7180 Trogdor Chromebooks is known to be affected
      so mark the 'local-bd-address' property as broken to maintain backwards
      compatibility with older firmware when fixing the underlying driver bug.
      
      Note that ChromeOS always updates the kernel and devicetree in lockstep
      so that there is no need to handle backwards compatibility with older
      devicetrees.
      
      Fixes: 7ec3e673
      
       ("arm64: dts: qcom: sc7180-trogdor: add initial trogdor and lazor dt")
      Cc: stable@vger.kernel.org      # 5.10
      Cc: Rob Clark <robdclark@chromium.org>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Acked-by: default avatarBjorn Andersson <andersson@kernel.org>
      Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      e12e2800
    • Johan Hovold's avatar
      dt-bindings: bluetooth: add 'qcom,local-bd-address-broken' · 7003de8a
      Johan Hovold authored
      
      
      Several Qualcomm Bluetooth controllers lack persistent storage for the
      device address and instead one can be provided by the boot firmware
      using the 'local-bd-address' devicetree property.
      
      The Bluetooth bindings clearly states that the address should be
      specified in little-endian order, but due to a long-standing bug in the
      Qualcomm driver which reversed the address some boot firmware has been
      providing the address in big-endian order instead.
      
      The only device out there that should be affected by this is the WCN3991
      used in some Chromebooks.
      
      Add a 'qcom,local-bd-address-broken' property which can be set on these
      platforms to indicate that the boot firmware is using the wrong byte
      order.
      
      Note that ChromeOS always updates the kernel and devicetree in lockstep
      so that there is no need to handle backwards compatibility with older
      devicetrees.
      
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7003de8a
    • Johan Hovold's avatar
      Revert "Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT" · 4790a73a
      Johan Hovold authored
      This reverts commit 7dcd3e01.
      
      Qualcomm Bluetooth controllers like WCN6855 do not have persistent
      storage for the Bluetooth address and must therefore start as
      unconfigured to allow the user to set a valid address unless one has
      been provided by the boot firmware in the devicetree.
      
      A recent change snuck into v6.8-rc7 and incorrectly started marking the
      default (non-unique) address as valid. This specifically also breaks the
      Bluetooth setup for some user of the Lenovo ThinkPad X13s.
      
      Note that this is the second time Qualcomm breaks the driver this way
      and that this was fixed last year by commit 6945795b ("Bluetooth:
      fix use-bdaddr-property quirk"), which also has some further details.
      
      Fixes: 7dcd3e01
      
       ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
      Cc: stable@vger.kernel.org      # 6.8
      Cc: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reported-by: default avatarClayton Craft <clayton@craftyguy.net>
      Tested-by: default avatarClayton Craft <clayton@craftyguy.net>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      4790a73a
    • Hariprasad Kelam's avatar
      octeontx2-af: Fix issue with loading coalesced KPU profiles · 0ba80d96
      Hariprasad Kelam authored
      The current implementation for loading coalesced KPU profiles has
      a limitation.  The "offset" field, which is used to locate profiles
      within the profile is restricted to a u16.
      
      This restricts the number of profiles that can be loaded. This patch
      addresses this limitation by increasing the size of the "offset" field.
      
      Fixes: 11c730bf
      
       ("octeontx2-af: support for coalescing KPU profiles")
      Signed-off-by: default avatarHariprasad Kelam <hkelam@marvell.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ba80d96