1. Jul 21, 2023
    • Siddh Raman Pant's avatar
      Bluetooth: hci_conn: return ERR_PTR instead of NULL when there is no link · b4066eb0
      Siddh Raman Pant authored
      
      
      hci_connect_sco currently returns NULL when there is no link (i.e. when
      hci_conn_link() returns NULL).
      
      sco_connect() expects an ERR_PTR in case of any error (see line 266 in
      sco.c). Thus, hcon set as NULL passes through to sco_conn_add(), which
      tries to get hcon->hdev, resulting in dereferencing a NULL pointer as
      reported by syzkaller.
      
      The same issue exists for iso_connect_cis() calling hci_connect_cis().
      
      Thus, make hci_connect_sco() and hci_connect_cis() return ERR_PTR
      instead of NULL.
      
      Reported-and-tested-by: default avatar <syzbot+37acd5d80d00d609d233@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=37acd5d80d00d609d233
      Fixes: 06149746
      
       ("Bluetooth: hci_conn: Add support for linking multiple hcon")
      Signed-off-by: default avatarSiddh Raman Pant <code@siddh.me>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      b4066eb0
    • Douglas Anderson's avatar
      Bluetooth: hci_sync: Avoid use-after-free in dbg for hci_remove_adv_monitor() · de6dfcef
      Douglas Anderson authored
      KASAN reports that there's a use-after-free in
      hci_remove_adv_monitor(). Trawling through the disassembly, you can
      see that the complaint is from the access in bt_dev_dbg() under the
      HCI_ADV_MONITOR_EXT_MSFT case. The problem case happens because
      msft_remove_monitor() can end up freeing the monitor
      structure. Specifically:
        hci_remove_adv_monitor() ->
        msft_remove_monitor() ->
        msft_remove_monitor_sync() ->
        msft_le_cancel_monitor_advertisement_cb() ->
        hci_free_adv_monitor()
      
      Let's fix the problem by just stashing the relevant data when it's
      still valid.
      
      Fixes: 7cf5c297
      
       ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      de6dfcef
    • Arnd Bergmann's avatar
      Bluetooth: coredump: fix building with coredump disabled · 6910e2eb
      Arnd Bergmann authored
      The btmtk driver uses an IS_ENABLED() check to conditionally compile
      the coredump support, but this fails to build because the hdev->dump
      member is in an #ifdef:
      
      drivers/bluetooth/btmtk.c: In function 'btmtk_process_coredump':
      drivers/bluetooth/btmtk.c:386:30: error: 'struct hci_dev' has no member named 'dump'
        386 |   schedule_delayed_work(&hdev->dump.dump_timeout,
            |                              ^~
      
      The struct member doesn't really make a huge difference in the total size,
      so just remove the #ifdef around it to avoid adding similar checks
      around each user.
      
      Fixes: 872f8c253cb9e ("Bluetooth: btusb: mediatek: add MediaTek devcoredump support")
      Fixes: 9695ef87
      
       ("Bluetooth: Add support for hci devcoredump")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      6910e2eb
    • Pauli Virtanen's avatar
      Bluetooth: ISO: fix iso_conn related locking and validity issues · d40ae85e
      Pauli Virtanen authored
      sk->sk_state indicates whether iso_pi(sk)->conn is valid. Operations
      that check/update sk_state and access conn should hold lock_sock,
      otherwise they can race.
      
      The order of taking locks is hci_dev_lock > lock_sock > iso_conn_lock,
      which is how it is in connect/disconnect_cfm -> iso_conn_del ->
      iso_chan_del.
      
      Fix locking in iso_connect_cis/bis and sendmsg/recvmsg to take lock_sock
      around updating sk_state and conn.
      
      iso_conn_del must not occur during iso_connect_cis/bis, as it frees the
      iso_conn. Hold hdev->lock longer to prevent that.
      
      This should not reintroduce the issue fixed in commit 241f5193
      ("Bluetooth: ISO: Avoid circular locking dependency"), since the we
      acquire locks in order. We retain the fix in iso_sock_connect to release
      lock_sock before iso_connect_* acquires hdev->lock.
      
      Similarly for commit 6a5ad251 ("Bluetooth: ISO: Fix possible
      circular locking dependency"). We retain the fix in iso_conn_ready to
      not acquire iso_conn_lock before lock_sock.
      
      iso_conn_add shall return iso_conn with valid hcon. Make it so also when
      reusing an old CIS connection waiting for disconnect timeout (see
      __iso_sock_close where conn->hcon is set to NULL).
      
      Trace with iso_conn_del after iso_chan_add in iso_connect_cis:
      ===============================================================
      iso_sock_create:771: sock 00000000be9b69b7
      iso_sock_init:693: sk 000000004dff667e
      iso_sock_bind:827: sk 000000004dff667e 70:1a:b8:98:ff:a2 type 1
      iso_sock_setsockopt:1289: sk 000000004dff667e
      iso_sock_setsockopt:1289: sk 000000004dff667e
      iso_sock_setsockopt:1289: sk 000000004dff667e
      iso_sock_connect:875: sk 000000004dff667e
      iso_connect_cis:353: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da
      hci_get_route:1199: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da
      hci_conn_add:1005: hci0 dst 28:3d:c2:4a:7e:da
      iso_conn_add:140: hcon 000000007b65d182 conn 00000000daf8625e
      __iso_chan_add:214: conn 00000000daf8625e
      iso_connect_cfm:1700: hcon 000000007b65d182 bdaddr 28:3d:c2:4a:7e:da status 12
      iso_conn_del:187: hcon 000000007b65d182 conn 00000000daf8625e, err 16
      iso_sock_clear_timer:117: sock 000000004dff667e state 3
          <Note: sk_state is BT_BOUND (3), so iso_connect_cis is still
          running at this point>
      iso_chan_del:153: sk 000000004dff667e, conn 00000000daf8625e, err 16
      hci_conn_del:1151: hci0 hcon 000000007b65d182 handle 65535
      hci_conn_unlink:1102: hci0: hcon 000000007b65d182
      hci_chan_list_flush:2780: hcon 000000007b65d182
      iso_sock_getsockopt:1376: sk 000000004dff667e
      iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e
      iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e
      iso_sock_getsockopt:1376: sk 000000004dff667e
      iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e
      iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e
      iso_sock_shutdown:1434: sock 00000000be9b69b7, sk 000000004dff667e, how 1
      __iso_sock_close:632: sk 000000004dff667e state 5 socket 00000000be9b69b7
           <Note: sk_state is BT_CONNECT (5), even though iso_chan_del sets
           BT_CLOSED (6). Only iso_connect_cis sets it to BT_CONNECT, so it
           must be that iso_chan_del occurred between iso_chan_add and end of
           iso_connect_cis.>
      BUG: kernel NULL pointer dereference, address: 0000000000000000
      PGD 8000000006467067 P4D 8000000006467067 PUD 3f5f067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP PTI
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014
      RIP: 0010:__iso_sock_close (net/bluetooth/iso.c:664) bluetooth
      ===============================================================
      
      Trace with iso_conn_del before iso_chan_add in iso_connect_cis:
      ===============================================================
      iso_connect_cis:356: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da
      ...
      iso_conn_add:140: hcon 0000000093bc551f conn 00000000768ae504
      hci_dev_put:1487: hci0 orig refcnt 21
      hci_event_packet:7607: hci0: event 0x0e
      hci_cmd_complete_evt:4231: hci0: opcode 0x2062
      hci_cc_le_set_cig_params:3846: hci0: status 0x07
      hci_sent_cmd_data:3107: hci0 opcode 0x2062
      iso_connect_cfm:1703: hcon 0000000093bc551f bdaddr 28:3d:c2:4a:7e:da status 7
      iso_conn_del:187: hcon 0000000093bc551f conn 00000000768ae504, err 12
      hci_conn_del:1151: hci0 hcon 0000000093bc551f handle 65535
      hci_conn_unlink:1102: hci0: hcon 0000000093bc551f
      hci_chan_list_flush:2780: hcon 0000000093bc551f
      __iso_chan_add:214: conn 00000000768ae504
          <Note: this conn was already freed in iso_conn_del above>
      iso_sock_clear_timer:117: sock 0000000098323f95 state 3
      general protection fault, probably for non-canonical address 0x30b29c630930aec8: 0000 [#1] PREEMPT SMP PTI
      CPU: 1 PID: 1920 Comm: bluetoothd Tainted: G            E      6.3.0-rc7+ #4
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014
      RIP: 0010:detach_if_pending+0x28/0xd0
      Code: 90 90 0f 1f 44 00 00 48 8b 47 08 48 85 c0 0f 84 ad 00 00 00 55 89 d5 53 48 83 3f 00 48 89 fb 74 7d 66 90 48 8b 03 48 8b 53 08 <>
      RSP: 0018:ffffb90841a67d08 EFLAGS: 00010007
      RAX: 0000000000000000 RBX: ffff9141bd5061b8 RCX: 0000000000000000
      RDX: 30b29c630930aec8 RSI: ffff9141fdd21e80 RDI: ffff9141bd5061b8
      RBP: 0000000000000001 R08: 0000000000000000 R09: ffffb90841a67b88
      R10: 0000000000000003 R11: ffffffff8613f558 R12: ffff9141fdd21e80
      R13: 0000000000000000 R14: ffff9141b5976010 R15: ffff914185755338
      FS:  00007f45768bd840(0000) GS:ffff9141fdd00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000619000424074 CR3: 0000000009f5e005 CR4: 0000000000170ee0
      Call Trace:
       <TASK>
       timer_delete+0x48/0x80
       try_to_grab_pending+0xdf/0x170
       __cancel_work+0x37/0xb0
       iso_connect_cis+0x141/0x400 [bluetooth]
      ===============================================================
      
      Trace with NULL conn->hcon in state BT_CONNECT:
      ===============================================================
      __iso_sock_close:619: sk 00000000f7c71fc5 state 1 socket 00000000d90c5fe5
      ...
      __iso_sock_close:619: sk 00000000f7c71fc5 state 8 socket 00000000d90c5fe5
      iso_chan_del:153: sk 00000000f7c71fc5, conn 0000000022c03a7e, err 104
      ...
      iso_sock_connect:862: sk 00000000129b56c3
      iso_connect_cis:348: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7d:2a
      hci_get_route:1199: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7d:2a
      hci_dev_hold:1495: hci0 orig refcnt 19
      __iso_chan_add:214: conn 0000000022c03a7e
          <Note: reusing old conn>
      iso_sock_clear_timer:117: sock 00000000129b56c3 state 3
      ...
      iso_sock_ready:1485: sk 00000000129b56c3
      ...
      iso_sock_sendmsg:1077: sock 00000000e5013966, sk 00000000129b56c3
      BUG: kernel NULL pointer dereference, address: 00000000000006a8
      PGD 0 P4D 0
      Oops: 0000 [#1] PREEMPT SMP PTI
      CPU: 1 PID: 1403 Comm: wireplumber Tainted: G            E      6.3.0-rc7+ #4
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014
      RIP: 0010:iso_sock_sendmsg+0x63/0x2a0 [bluetooth]
      ===============================================================
      
      Fixes: 241f5193 ("Bluetooth: ISO: Avoid circular locking dependency")
      Fixes: 6a5ad251
      
       ("Bluetooth: ISO: Fix possible circular locking dependency")
      Signed-off-by: default avatarPauli Virtanen <pav@iki.fi>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      d40ae85e
    • Pauli Virtanen's avatar
      Bluetooth: hci_event: call disconnect callback before deleting conn · 7f7cfcb6
      Pauli Virtanen authored
      In hci_cs_disconnect, we do hci_conn_del even if disconnection failed.
      
      ISO, L2CAP and SCO connections refer to the hci_conn without
      hci_conn_get, so disconn_cfm must be called so they can clean up their
      conn, otherwise use-after-free occurs.
      
      ISO:
      ==========================================================
      iso_sock_connect:880: sk 00000000eabd6557
      iso_connect_cis:356: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da
      ...
      iso_conn_add:140: hcon 000000001696f1fd conn 00000000b6251073
      hci_dev_put:1487: hci0 orig refcnt 17
      __iso_chan_add:214: conn 00000000b6251073
      iso_sock_clear_timer:117: sock 00000000eabd6557 state 3
      ...
      hci_rx_work:4085: hci0 Event packet
      hci_event_packet:7601: hci0: event 0x0f
      hci_cmd_status_evt:4346: hci0: opcode 0x0406
      hci_cs_disconnect:2760: hci0: status 0x0c
      hci_sent_cmd_data:3107: hci0 opcode 0x0406
      hci_conn_del:1151: hci0 hcon 000000001696f1fd handle 2560
      hci_conn_unlink:1102: hci0: hcon 000000001696f1fd
      hci_conn_drop:1451: hcon 00000000d8521aaf orig refcnt 2
      hci_chan_list_flush:2780: hcon 000000001696f1fd
      hci_dev_put:1487: hci0 orig refcnt 21
      hci_dev_put:1487: hci0 orig refcnt 20
      hci_req_cmd_complete:3978: opcode 0x0406 status 0x0c
      ... <no iso_* activity on sk/conn> ...
      iso_sock_sendmsg:1098: sock 00000000dea5e2e0, sk 00000000eabd6557
      BUG: kernel NULL pointer dereference, address: 0000000000000668
      PGD 0 P4D 0
      Oops: 0000 [#1] PREEMPT SMP PTI
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014
      RIP: 0010:iso_sock_sendmsg (net/bluetooth/iso.c:1112) bluetooth
      ==========================================================
      
      L2CAP:
      ==================================================================
      hci_cmd_status_evt:4359: hci0: opcode 0x0406
      hci_cs_disconnect:2760: hci0: status 0x0c
      hci_sent_cmd_data:3085: hci0 opcode 0x0406
      hci_conn_del:1151: hci0 hcon ffff88800c999000 handle 3585
      hci_conn_unlink:1102: hci0: hcon ffff88800c999000
      hci_chan_list_flush:2780: hcon ffff88800c999000
      hci_chan_del:2761: hci0 hcon ffff88800c999000 chan ffff888018ddd280
      ...
      BUG: KASAN: slab-use-after-free in hci_send_acl+0x2d/0x540 [bluetooth]
      Read of size 8 at addr ffff888018ddd298 by task bluetoothd/1175
      
      CPU: 0 PID: 1175 Comm: bluetoothd Tainted: G            E      6.4.0-rc4+ #2
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014
      Call Trace:
       <TASK>
       dump_stack_lvl+0x5b/0x90
       print_report+0xcf/0x670
       ? __virt_addr_valid+0xf8/0x180
       ? hci_send_acl+0x2d/0x540 [bluetooth]
       kasan_report+0xa8/0xe0
       ? hci_send_acl+0x2d/0x540 [bluetooth]
       hci_send_acl+0x2d/0x540 [bluetooth]
       ? __pfx___lock_acquire+0x10/0x10
       l2cap_chan_send+0x1fd/0x1300 [bluetooth]
       ? l2cap_sock_sendmsg+0xf2/0x170 [bluetooth]
       ? __pfx_l2cap_chan_send+0x10/0x10 [bluetooth]
       ? lock_release+0x1d5/0x3c0
       ? mark_held_locks+0x1a/0x90
       l2cap_sock_sendmsg+0x100/0x170 [bluetooth]
       sock_write_iter+0x275/0x280
       ? __pfx_sock_write_iter+0x10/0x10
       ? __pfx___lock_acquire+0x10/0x10
       do_iter_readv_writev+0x176/0x220
       ? __pfx_do_iter_readv_writev+0x10/0x10
       ? find_held_lock+0x83/0xa0
       ? selinux_file_permission+0x13e/0x210
       do_iter_write+0xda/0x340
       vfs_writev+0x1b4/0x400
       ? __pfx_vfs_writev+0x10/0x10
       ? __seccomp_filter+0x112/0x750
       ? populate_seccomp_data+0x182/0x220
       ? __fget_light+0xdf/0x100
       ? do_writev+0x19d/0x210
       do_writev+0x19d/0x210
       ? __pfx_do_writev+0x10/0x10
       ? mark_held_locks+0x1a/0x90
       do_syscall_64+0x60/0x90
       ? lockdep_hardirqs_on_prepare+0x149/0x210
       ? do_syscall_64+0x6c/0x90
       ? lockdep_hardirqs_on_prepare+0x149/0x210
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      RIP: 0033:0x7ff45cb23e64
      Code: 15 d1 1f 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 80 3d 9d a7 0d 00 00 74 13 b8 14 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 48 83 ec 28 89 54 24 1c 48 89
      RSP: 002b:00007fff21ae09b8 EFLAGS: 00000202 ORIG_RAX: 0000000000000014
      RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007ff45cb23e64
      RDX: 0000000000000001 RSI: 00007fff21ae0aa0 RDI: 0000000000000017
      RBP: 00007fff21ae0aa0 R08: 000000000095a8a0 R09: 0000607000053f40
      R10: 0000000000000001 R11: 0000000000000202 R12: 00007fff21ae0ac0
      R13: 00000fffe435c150 R14: 00007fff21ae0a80 R15: 000060f000000040
       </TASK>
      
      Allocated by task 771:
       kasan_save_stack+0x33/0x60
       kasan_set_track+0x25/0x30
       __kasan_kmalloc+0xaa/0xb0
       hci_chan_create+0x67/0x1b0 [bluetooth]
       l2cap_conn_add.part.0+0x17/0x590 [bluetooth]
       l2cap_connect_cfm+0x266/0x6b0 [bluetooth]
       hci_le_remote_feat_complete_evt+0x167/0x310 [bluetooth]
       hci_event_packet+0x38d/0x800 [bluetooth]
       hci_rx_work+0x287/0xb20 [bluetooth]
       process_one_work+0x4f7/0x970
       worker_thread+0x8f/0x620
       kthread+0x17f/0x1c0
       ret_from_fork+0x2c/0x50
      
      Freed by task 771:
       kasan_save_stack+0x33/0x60
       kasan_set_track+0x25/0x30
       kasan_save_free_info+0x2e/0x50
       ____kasan_slab_free+0x169/0x1c0
       slab_free_freelist_hook+0x9e/0x1c0
       __kmem_cache_free+0xc0/0x310
       hci_chan_list_flush+0x46/0x90 [bluetooth]
       hci_conn_cleanup+0x7d/0x330 [bluetooth]
       hci_cs_disconnect+0x35d/0x530 [bluetooth]
       hci_cmd_status_evt+0xef/0x2b0 [bluetooth]
       hci_event_packet+0x38d/0x800 [bluetooth]
       hci_rx_work+0x287/0xb20 [bluetooth]
       process_one_work+0x4f7/0x970
       worker_thread+0x8f/0x620
       kthread+0x17f/0x1c0
       ret_from_fork+0x2c/0x50
      ==================================================================
      
      Fixes: b8d29052
      
       ("Bluetooth: clean up connection in hci_cs_disconnect")
      Signed-off-by: default avatarPauli Virtanen <pav@iki.fi>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7f7cfcb6
    • Pauli Virtanen's avatar
      Bluetooth: use RCU for hci_conn_params and iterate safely in hci_sync · 195ef75e
      Pauli Virtanen authored
      hci_update_accept_list_sync iterates over hdev->pend_le_conns and
      hdev->pend_le_reports, and waits for controller events in the loop body,
      without holding hdev lock.
      
      Meanwhile, these lists and the items may be modified e.g. by
      le_scan_cleanup. This can invalidate the list cursor or any other item
      in the list, resulting to invalid behavior (eg use-after-free).
      
      Use RCU for the hci_conn_params action lists. Since the loop bodies in
      hci_sync block and we cannot use RCU or hdev->lock for the whole loop,
      copy list items first and then iterate on the copy. Only the flags field
      is written from elsewhere, so READ_ONCE/WRITE_ONCE should guarantee we
      read valid values.
      
      Free params everywhere with hci_conn_params_free so the cleanup is
      guaranteed to be done properly.
      
      This fixes the following, which can be triggered e.g. by BlueZ new
      mgmt-tester case "Add + Remove Device Nowait - Success", or by changing
      hci_le_set_cig_params to always return false, and running iso-tester:
      
      ==================================================================
      BUG: KASAN: slab-use-after-free in hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841)
      Read of size 8 at addr ffff888001265018 by task kworker/u3:0/32
      
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014
      Workqueue: hci0 hci_cmd_sync_work
      Call Trace:
      <TASK>
      dump_stack_lvl (./arch/x86/include/asm/irqflags.h:134 lib/dump_stack.c:107)
      print_report (mm/kasan/report.c:320 mm/kasan/report.c:430)
      ? __virt_addr_valid (./include/linux/mmzone.h:1915 ./include/linux/mmzone.h:2011 arch/x86/mm/physaddr.c:65)
      ? hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841)
      kasan_report (mm/kasan/report.c:538)
      ? hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841)
      hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841)
      ? __pfx_hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2780)
      ? mutex_lock (kernel/locking/mutex.c:282)
      ? __pfx_mutex_lock (kernel/locking/mutex.c:282)
      ? __pfx_mutex_unlock (kernel/locking/mutex.c:538)
      ? __pfx_update_passive_scan_sync (net/bluetooth/hci_sync.c:2861)
      hci_cmd_sync_work (net/bluetooth/hci_sync.c:306)
      process_one_work (./arch/x86/include/asm/preempt.h:27 kernel/workqueue.c:2399)
      worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2538)
      ? __pfx_worker_thread (kernel/workqueue.c:2480)
      kthread (kernel/kthread.c:376)
      ? __pfx_kthread (kernel/kthread.c:331)
      ret_from_fork (arch/x86/entry/entry_64.S:314)
      </TASK>
      
      Allocated by task 31:
      kasan_save_stack (mm/kasan/common.c:46)
      kasan_set_track (mm/kasan/common.c:52)
      __kasan_kmalloc (mm/kasan/common.c:374 mm/kasan/common.c:383)
      hci_conn_params_add (./include/linux/slab.h:580 ./include/linux/slab.h:720 net/bluetooth/hci_core.c:2277)
      hci_connect_le_scan (net/bluetooth/hci_conn.c:1419 net/bluetooth/hci_conn.c:1589)
      hci_connect_cis (net/bluetooth/hci_conn.c:2266)
      iso_connect_cis (net/bluetooth/iso.c:390)
      iso_sock_connect (net/bluetooth/iso.c:899)
      __sys_connect (net/socket.c:2003 net/socket.c:2020)
      __x64_sys_connect (net/socket.c:2027)
      do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
      entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
      
      Freed by task 15:
      kasan_save_stack (mm/kasan/common.c:46)
      kasan_set_track (mm/kasan/common.c:52)
      kasan_save_free_info (mm/kasan/generic.c:523)
      __kasan_slab_free (mm/kasan/common.c:238 mm/kasan/common.c:200 mm/kasan/common.c:244)
      __kmem_cache_free (mm/slub.c:1807 mm/slub.c:3787 mm/slub.c:3800)
      hci_conn_params_del (net/bluetooth/hci_core.c:2323)
      le_scan_cleanup (net/bluetooth/hci_conn.c:202)
      process_one_work (./arch/x86/include/asm/preempt.h:27 kernel/workqueue.c:2399)
      worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2538)
      kthread (kernel/kthread.c:376)
      ret_from_fork (arch/x86/entry/entry_64.S:314)
      ==================================================================
      
      Fixes: e8907f76
      
       ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3")
      Signed-off-by: default avatarPauli Virtanen <pav@iki.fi>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      195ef75e
  2. Jul 20, 2023
  3. Jul 19, 2023