1. 04 Jul, 2024 15 commits
  2. 03 Jul, 2024 4 commits
    • Florian Westphal's avatar
      netfilter: nf_tables: unconditionally flush pending work before notifier · 9f6958ba
      Florian Westphal authored
      syzbot reports:
      
      KASAN: slab-uaf in nft_ctx_update include/net/netfilter/nf_tables.h:1831
      KASAN: slab-uaf in nft_commit_release net/netfilter/nf_tables_api.c:9530
      KASAN: slab-uaf int nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597
      Read of size 2 at addr ffff88802b0051c4 by task kworker/1:1/45
      [..]
      Workqueue: events nf_tables_trans_destroy_work
      Call Trace:
       nft_ctx_update include/net/netfilter/nf_tables.h:1831 [inline]
       nft_commit_release net/netfilter/nf_tables_api.c:9530 [inline]
       nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597
      
      Problem is that the notifier does a conditional flush, but its possible
      that the table-to-be-removed is still referenced by transactions being
      processed by the worker, so we need to flush unconditionally.
      
      We could make the flush_work depend on whether we found a table to delete
      in nf-next to avoid the flush for most cases.
      
      AFAICS this problem is only exposed in nf-next, with
      commit e169285f ("netfilter: nf_tables: do not store nft_ctx in transaction objects"),
      with this commit applied there is an unconditional fetch of
      table->family which is whats triggering the above splat.
      
      Fixes: 2c9f0293 ("netfilter: nf_tables: flush pending destroy work before netlink notifier")
      Reported-and-tested-by: syzbot+4fd66a69358fc15ae2ad@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=4fd66a69358fc15ae2adSigned-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      9f6958ba
    • Furong Xu's avatar
      net: stmmac: enable HW-accelerated VLAN stripping for gmac4 only · 8eb301bd
      Furong Xu authored
      Commit 750011e2 ("net: stmmac: Add support for HW-accelerated VLAN
      stripping") enables MAC level VLAN tag stripping for all MAC cores, but
      leaves set_hw_vlan_mode() and rx_hw_vlan() un-implemented for both gmac
      and xgmac.
      
      On gmac and xgmac, ethtool reports rx-vlan-offload is on, both MAC and
      driver do nothing about VLAN packets actually, although VLAN works well.
      
      Driver level stripping should be used on gmac and xgmac for now.
      
      Fixes: 750011e2 ("net: stmmac: Add support for HW-accelerated VLAN stripping")
      Signed-off-by: default avatarFurong Xu <0x1207@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8eb301bd
    • Dave Jiang's avatar
      net: ntb_netdev: Move ntb_netdev_rx_handler() to call netif_rx() from __netif_rx() · e15a5d82
      Dave Jiang authored
      The following is emitted when using idxd (DSA) dmanegine as the data
      mover for ntb_transport that ntb_netdev uses.
      
      [74412.546922] BUG: using smp_processor_id() in preemptible [00000000] code: irq/52-idxd-por/14526
      [74412.556784] caller is netif_rx_internal+0x42/0x130
      [74412.562282] CPU: 6 PID: 14526 Comm: irq/52-idxd-por Not tainted 6.9.5 #5
      [74412.569870] Hardware name: Intel Corporation ArcherCity/ArcherCity, BIOS EGSDCRB1.E9I.1752.P05.2402080856 02/08/2024
      [74412.581699] Call Trace:
      [74412.584514]  <TASK>
      [74412.586933]  dump_stack_lvl+0x55/0x70
      [74412.591129]  check_preemption_disabled+0xc8/0xf0
      [74412.596374]  netif_rx_internal+0x42/0x130
      [74412.600957]  __netif_rx+0x20/0xd0
      [74412.604743]  ntb_netdev_rx_handler+0x66/0x150 [ntb_netdev]
      [74412.610985]  ntb_complete_rxc+0xed/0x140 [ntb_transport]
      [74412.617010]  ntb_rx_copy_callback+0x53/0x80 [ntb_transport]
      [74412.623332]  idxd_dma_complete_txd+0xe3/0x160 [idxd]
      [74412.628963]  idxd_wq_thread+0x1a6/0x2b0 [idxd]
      [74412.634046]  irq_thread_fn+0x21/0x60
      [74412.638134]  ? irq_thread+0xa8/0x290
      [74412.642218]  irq_thread+0x1a0/0x290
      [74412.646212]  ? __pfx_irq_thread_fn+0x10/0x10
      [74412.651071]  ? __pfx_irq_thread_dtor+0x10/0x10
      [74412.656117]  ? __pfx_irq_thread+0x10/0x10
      [74412.660686]  kthread+0x100/0x130
      [74412.664384]  ? __pfx_kthread+0x10/0x10
      [74412.668639]  ret_from_fork+0x31/0x50
      [74412.672716]  ? __pfx_kthread+0x10/0x10
      [74412.676978]  ret_from_fork_asm+0x1a/0x30
      [74412.681457]  </TASK>
      
      The cause is due to the idxd driver interrupt completion handler uses
      threaded interrupt and the threaded handler is not hard or soft interrupt
      context. However __netif_rx() can only be called from interrupt context.
      Change the call to netif_rx() in order to allow completion via normal
      context for dmaengine drivers that utilize threaded irq handling.
      
      While the following commit changed from netif_rx() to __netif_rx(),
      baebdf48 ("net: dev: Makes sure netif_rx() can be invoked in any context."),
      the change should've been a noop instead. However, the code precedes this
      fix should've been using netif_rx_ni() or netif_rx_any_context().
      
      Fixes: 548c237c ("net: Add support for NTB virtual ethernet device")
      Reported-by: default avatarJerry Dai <jerry.dai@intel.com>
      Tested-by: default avatarJerry Dai <jerry.dai@intel.com>
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Link: https://patch.msgid.link/20240701181538.3799546-1-dave.jiang@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e15a5d82
    • Bartosz Golaszewski's avatar
      net: phy: aquantia: add missing include guards · 21934375
      Bartosz Golaszewski authored
      The header is missing the include guards so add them.
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Fixes: fb470f70 ("net: phy: aquantia: add hwmon support")
      Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      Link: https://patch.msgid.link/20240701080322.9569-1-brgl@bgdev.plSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      21934375
  3. 02 Jul, 2024 9 commits
  4. 01 Jul, 2024 3 commits
  5. 29 Jun, 2024 1 commit
    • Ghadi Elie Rahme's avatar
      bnx2x: Fix multiple UBSAN array-index-out-of-bounds · 13406116
      Ghadi Elie Rahme authored
      Fix UBSAN warnings that occur when using a system with 32 physical
      cpu cores or more, or when the user defines a number of Ethernet
      queues greater than or equal to FP_SB_MAX_E1x using the num_queues
      module parameter.
      
      Currently there is a read/write out of bounds that occurs on the array
      "struct stats_query_entry query" present inside the "bnx2x_fw_stats_req"
      struct in "drivers/net/ethernet/broadcom/bnx2x/bnx2x.h".
      Looking at the definition of the "struct stats_query_entry query" array:
      
      struct stats_query_entry query[FP_SB_MAX_E1x+
               BNX2X_FIRST_QUEUE_QUERY_IDX];
      
      FP_SB_MAX_E1x is defined as the maximum number of fast path interrupts and
      has a value of 16, while BNX2X_FIRST_QUEUE_QUERY_IDX has a value of 3
      meaning the array has a total size of 19.
      Since accesses to "struct stats_query_entry query" are offset-ted by
      BNX2X_FIRST_QUEUE_QUERY_IDX, that means that the total number of Ethernet
      queues should not exceed FP_SB_MAX_E1x (16). However one of these queues
      is reserved for FCOE and thus the number of Ethernet queues should be set
      to [FP_SB_MAX_E1x -1] (15) if FCOE is enabled or [FP_SB_MAX_E1x] (16) if
      it is not.
      
      This is also described in a comment in the source code in
      drivers/net/ethernet/broadcom/bnx2x/bnx2x.h just above the Macro definition
      of FP_SB_MAX_E1x. Below is the part of this explanation that it important
      for this patch
      
      /*
        * The total number of L2 queues, MSIX vectors and HW contexts (CIDs) is
        * control by the number of fast-path status blocks supported by the
        * device (HW/FW). Each fast-path status block (FP-SB) aka non-default
        * status block represents an independent interrupts context that can
        * serve a regular L2 networking queue. However special L2 queues such
        * as the FCoE queue do not require a FP-SB and other components like
        * the CNIC may consume FP-SB reducing the number of possible L2 queues
        *
        * If the maximum number of FP-SB available is X then:
        * a. If CNIC is supported it consumes 1 FP-SB thus the max number of
        *    regular L2 queues is Y=X-1
        * b. In MF mode the actual number of L2 queues is Y= (X-1/MF_factor)
        * c. If the FCoE L2 queue is supported the actual number of L2 queues
        *    is Y+1
        * d. The number of irqs (MSIX vectors) is either Y+1 (one extra for
        *    slow-path interrupts) or Y+2 if CNIC is supported (one additional
        *    FP interrupt context for the CNIC).
        * e. The number of HW context (CID count) is always X or X+1 if FCoE
        *    L2 queue is supported. The cid for the FCoE L2 queue is always X.
        */
      
      However this driver also supports NICs that use the E2 controller which can
      handle more queues due to having more FP-SB represented by FP_SB_MAX_E2.
      Looking at the commits when the E2 support was added, it was originally
      using the E1x parameters: commit f2e0899f ("bnx2x: Add 57712 support").
      Back then FP_SB_MAX_E2 was set to 16 the same as E1x. However the driver
      was later updated to take full advantage of the E2 instead of having it be
      limited to the capabilities of the E1x. But as far as we can tell, the
      array "stats_query_entry query" was still limited to using the FP-SB
      available to the E1x cards as part of an oversignt when the driver was
      updated to take full advantage of the E2, and now with the driver being
      aware of the greater queue size supported by E2 NICs, it causes the UBSAN
      warnings seen in the stack traces below.
      
      This patch increases the size of the "stats_query_entry query" array by
      replacing FP_SB_MAX_E1x with FP_SB_MAX_E2 to be large enough to handle
      both types of NICs.
      
      Stack traces:
      
      UBSAN: array-index-out-of-bounds in
             drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c:1529:11
      index 20 is out of range for type 'stats_query_entry [19]'
      CPU: 12 PID: 858 Comm: systemd-network Not tainted 6.9.0-060900rc7-generic
      	     #202405052133
      Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9,
      	       BIOS P89 10/21/2019
      Call Trace:
       <TASK>
       dump_stack_lvl+0x76/0xa0
       dump_stack+0x10/0x20
       __ubsan_handle_out_of_bounds+0xcb/0x110
       bnx2x_prep_fw_stats_req+0x2e1/0x310 [bnx2x]
       bnx2x_stats_init+0x156/0x320 [bnx2x]
       bnx2x_post_irq_nic_init+0x81/0x1a0 [bnx2x]
       bnx2x_nic_load+0x8e8/0x19e0 [bnx2x]
       bnx2x_open+0x16b/0x290 [bnx2x]
       __dev_open+0x10e/0x1d0
      RIP: 0033:0x736223927a0a
      Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca
            64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00
            f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
      RSP: 002b:00007ffc0bb2ada8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000583df50f9c78 RCX: 0000736223927a0a
      RDX: 0000000000000020 RSI: 0000583df50ee510 RDI: 0000000000000003
      RBP: 0000583df50d4940 R08: 00007ffc0bb2adb0 R09: 0000000000000080
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000583df5103ae0
      R13: 000000000000035a R14: 0000583df50f9c30 R15: 0000583ddddddf00
      </TASK>
      ---[ end trace ]---
      ------------[ cut here ]------------
      UBSAN: array-index-out-of-bounds in
             drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c:1546:11
      index 28 is out of range for type 'stats_query_entry [19]'
      CPU: 12 PID: 858 Comm: systemd-network Not tainted 6.9.0-060900rc7-generic
      	     #202405052133
      Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9,
      	       BIOS P89 10/21/2019
      Call Trace:
      <TASK>
      dump_stack_lvl+0x76/0xa0
      dump_stack+0x10/0x20
      __ubsan_handle_out_of_bounds+0xcb/0x110
      bnx2x_prep_fw_stats_req+0x2fd/0x310 [bnx2x]
      bnx2x_stats_init+0x156/0x320 [bnx2x]
      bnx2x_post_irq_nic_init+0x81/0x1a0 [bnx2x]
      bnx2x_nic_load+0x8e8/0x19e0 [bnx2x]
      bnx2x_open+0x16b/0x290 [bnx2x]
      __dev_open+0x10e/0x1d0
      RIP: 0033:0x736223927a0a
      Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca
            64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00
            f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
      RSP: 002b:00007ffc0bb2ada8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000583df50f9c78 RCX: 0000736223927a0a
      RDX: 0000000000000020 RSI: 0000583df50ee510 RDI: 0000000000000003
      RBP: 0000583df50d4940 R08: 00007ffc0bb2adb0 R09: 0000000000000080
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000583df5103ae0
      R13: 000000000000035a R14: 0000583df50f9c30 R15: 0000583ddddddf00
       </TASK>
      ---[ end trace ]---
      ------------[ cut here ]------------
      UBSAN: array-index-out-of-bounds in
             drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:1895:8
      index 29 is out of range for type 'stats_query_entry [19]'
      CPU: 13 PID: 163 Comm: kworker/u96:1 Not tainted 6.9.0-060900rc7-generic
      	     #202405052133
      Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9,
      	       BIOS P89 10/21/2019
      Workqueue: bnx2x bnx2x_sp_task [bnx2x]
      Call Trace:
       <TASK>
       dump_stack_lvl+0x76/0xa0
       dump_stack+0x10/0x20
       __ubsan_handle_out_of_bounds+0xcb/0x110
       bnx2x_iov_adjust_stats_req+0x3c4/0x3d0 [bnx2x]
       bnx2x_storm_stats_post.part.0+0x4a/0x330 [bnx2x]
       ? bnx2x_hw_stats_post+0x231/0x250 [bnx2x]
       bnx2x_stats_start+0x44/0x70 [bnx2x]
       bnx2x_stats_handle+0x149/0x350 [bnx2x]
       bnx2x_attn_int_asserted+0x998/0x9b0 [bnx2x]
       bnx2x_sp_task+0x491/0x5c0 [bnx2x]
       process_one_work+0x18d/0x3f0
       </TASK>
      ---[ end trace ]---
      
      Fixes: 50f0a562 ("bnx2x: add fcoe statistics")
      Signed-off-by: default avatarGhadi Elie Rahme <ghadi.rahme@canonical.com>
      Cc: stable@vger.kernel.org
      Link: https://patch.msgid.link/20240627111405.1037812-1-ghadi.rahme@canonical.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      13406116
  6. 28 Jun, 2024 8 commits
    • Luiz Augusto von Dentz's avatar
      Bluetooth: L2CAP: Fix deadlock · f1a8f402
      Luiz Augusto von Dentz authored
      This fixes the following deadlock introduced by 39a92a55be13
      ("bluetooth/l2cap: sync sock recv cb and release")
      
      ============================================
      WARNING: possible recursive locking detected
      6.10.0-rc3-g4029dba6b6f1 #6823 Not tainted
      --------------------------------------------
      kworker/u5:0/35 is trying to acquire lock:
      ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
      l2cap_sock_recv_cb+0x44/0x1e0
      
      but task is already holding lock:
      ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
      l2cap_get_chan_by_scid+0xaf/0xd0
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(&chan->lock#2/1);
        lock(&chan->lock#2/1);
      
       *** DEADLOCK ***
      
       May be due to missing lock nesting notation
      
      3 locks held by kworker/u5:0/35:
       #0: ffff888002b8a940 ((wq_completion)hci0#2){+.+.}-{0:0}, at:
      process_one_work+0x750/0x930
       #1: ffff888002c67dd0 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0},
      at: process_one_work+0x44e/0x930
       #2: ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
      l2cap_get_chan_by_scid+0xaf/0xd0
      
      To fix the original problem this introduces l2cap_chan_lock at
      l2cap_conless_channel to ensure that l2cap_sock_recv_cb is called with
      chan->lock held.
      
      Fixes: 89e856e1 ("bluetooth/l2cap: sync sock recv cb and release")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      f1a8f402
    • Pavel Skripkin's avatar
      bluetooth/hci: disallow setting handle bigger than HCI_CONN_HANDLE_MAX · 1cc18c2a
      Pavel Skripkin authored
      Syzbot hit warning in hci_conn_del() caused by freeing handle that was
      not allocated using ida allocator.
      
      This is caused by handle bigger than HCI_CONN_HANDLE_MAX passed by
      hci_le_big_sync_established_evt(), which makes code think it's unset
      connection.
      
      Add same check for handle upper bound as in hci_conn_set_handle() to
      prevent warning.
      
      Link: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474
      Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com
      Fixes: 181a42ed ("Bluetooth: Make handle of hci_conn be unique")
      Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      1cc18c2a
    • Iulia Tanasescu's avatar
      Bluetooth: ISO: Check socket flag instead of hcon · 596b6f08
      Iulia Tanasescu authored
      This fixes the following Smatch static checker warning:
      
      net/bluetooth/iso.c:1364 iso_sock_recvmsg()
      error: we previously assumed 'pi->conn->hcon' could be null (line 1359)
      
      net/bluetooth/iso.c
      1347 static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,
      1348                             size_t len, int flags)
      1349 {
      1350         struct sock *sk = sock->sk;
      1351         struct iso_pinfo *pi = iso_pi(sk);
      1352
      1353         BT_DBG("sk %p", sk);
      1354
      1355         if (test_and_clear_bit(BT_SK_DEFER_SETUP,
                                            &bt_sk(sk)->flags)) {
      1356                 lock_sock(sk);
      1357                 switch (sk->sk_state) {
      1358                 case BT_CONNECT2:
      1359                         if (pi->conn->hcon &&
                                           ^^^^^^^^^^^^^^ If ->hcon is NULL
      
      1360                             test_bit(HCI_CONN_PA_SYNC,
                                               &pi->conn->hcon->flags)) {
      1361                                 iso_conn_big_sync(sk);
      1362                                 sk->sk_state = BT_LISTEN;
      1363                         } else {
      --> 1364                         iso_conn_defer_accept(pi->conn->hcon);
                                                             ^^^^^^^^^^^^^^
                                                             then we're toast
      
      1365                                 sk->sk_state = BT_CONFIG;
      1366                         }
      1367                         release_sock(sk);
      1368                         return 0;
      1369                 case BT_CONNECTED:
      1370                         if (test_bit(BT_SK_PA_SYNC,
      
      Fixes: fbdc4bc4 ("Bluetooth: ISO: Use defer setup to separate PA sync and BIG sync")
      Signed-off-by: default avatarIulia Tanasescu <iulia.tanasescu@nxp.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      596b6f08
    • Edward Adam Davis's avatar
      bluetooth/l2cap: sync sock recv cb and release · 89e856e1
      Edward Adam Davis authored
      The problem occurs between the system call to close the sock and hci_rx_work,
      where the former releases the sock and the latter accesses it without lock protection.
      
                 CPU0                       CPU1
                 ----                       ----
                 sock_close                 hci_rx_work
      	   l2cap_sock_release         hci_acldata_packet
      	   l2cap_sock_kill            l2cap_recv_frame
      	   sk_free                    l2cap_conless_channel
      	                              l2cap_sock_recv_cb
      
      If hci_rx_work processes the data that needs to be received before the sock is
      closed, then everything is normal; Otherwise, the work thread may access the
      released sock when receiving data.
      
      Add a chan mutex in the rx callback of the sock to achieve synchronization between
      the sock release and recv cb.
      
      Sock is dead, so set chan data to NULL, avoid others use invalid sock pointer.
      
      Reported-and-tested-by: syzbot+b7f6f8c9303466e16c8a@syzkaller.appspotmail.com
      Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      89e856e1
    • Edward Adam Davis's avatar
      Bluetooth: Ignore too large handle values in BIG · 015d79c9
      Edward Adam Davis authored
      hci_le_big_sync_established_evt is necessary to filter out cases where the
      handle value is belonging to ida id range, otherwise ida will be erroneously
      released in hci_conn_cleanup.
      
      Fixes: 181a42ed ("Bluetooth: Make handle of hci_conn be unique")
      Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      015d79c9
    • Neeraj Sanjay Kale's avatar
      Bluetooth: btnxpuart: Enable Power Save feature on startup · 4183a7be
      Neeraj Sanjay Kale authored
      This sets the default power save mode setting to enabled.
      
      The power save feature is now stable and stress test issues, such as the
      TX timeout error, have been resolved.
      commit c7ee0bc8db32 ("Bluetooth: btnxpuart: Resolve TX timeout error in
      power save stress test")
      
      With this setting, the driver will send the vendor command to FW at
      startup, to enable power save feature.
      
      User can disable this feature using the following vendor command:
      hcitool cmd 3f 23 03 00 00 (HCI_NXP_AUTO_SLEEP_MODE)
      Signed-off-by: default avatarNeeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
      Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      4183a7be
    • Tetsuo Handa's avatar
      Bluetooth: hci_core: cancel all works upon hci_unregister_dev() · 0d151a10
      Tetsuo Handa authored
      syzbot is reporting that calling hci_release_dev() from hci_error_reset()
      due to hci_dev_put() from hci_error_reset() can cause deadlock at
      destroy_workqueue(), for hci_error_reset() is called from
      hdev->req_workqueue which destroy_workqueue() needs to flush.
      
      We need to make sure that hdev->{rx_work,cmd_work,tx_work} which are
      queued into hdev->workqueue and hdev->{power_on,error_reset} which are
      queued into hdev->req_workqueue are no longer running by the moment
      
             destroy_workqueue(hdev->workqueue);
             destroy_workqueue(hdev->req_workqueue);
      
      are called from hci_release_dev().
      
      Call cancel_work_sync() on these work items from hci_unregister_dev()
      as soon as hdev->list is removed from hci_dev_list.
      Reported-by: default avatarsyzbot <syzbot+da0a9c9721e36db712e8@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=da0a9c9721e36db712e8Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      0d151a10
    • Zijun Hu's avatar
      Bluetooth: qca: Fix BT enable failure again for QCA6390 after warm reboot · 88e72239
      Zijun Hu authored
      Commit 272970be ("Bluetooth: hci_qca: Fix driver shutdown on closed
      serdev") will cause below regression issue:
      
      BT can't be enabled after below steps:
      cold boot -> enable BT -> disable BT -> warm reboot -> BT enable failure
      if property enable-gpios is not configured within DT|ACPI for QCA6390.
      
      The commit is to fix a use-after-free issue within qca_serdev_shutdown()
      by adding condition to avoid the serdev is flushed or wrote after closed
      but also introduces this regression issue regarding above steps since the
      VSC is not sent to reset controller during warm reboot.
      
      Fixed by sending the VSC to reset controller within qca_serdev_shutdown()
      once BT was ever enabled, and the use-after-free issue is also fixed by
      this change since the serdev is still opened before it is flushed or wrote.
      
      Verified by the reported machine Dell XPS 13 9310 laptop over below two
      kernel commits:
      commit e00fc2700a3f ("Bluetooth: btusb: Fix triggering coredump
      implementation for QCA") of bluetooth-next tree.
      commit b23d98d4 ("Bluetooth: btusb: Fix triggering coredump
      implementation for QCA") of linus mainline tree.
      
      Fixes: 272970be ("Bluetooth: hci_qca: Fix driver shutdown on closed serdev")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarWren Turkal <wt@penguintechs.org>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218726Signed-off-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
      Tested-by: default avatarWren Turkal <wt@penguintechs.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      88e72239