linux-stable/drivers/bluetooth
Pavel Skripkin 9d7cbe2b9c Bluetooth: hci_serdev: call init_rwsem() before p->open()
kvartet reported, that hci_uart_tx_wakeup() uses uninitialized rwsem.
The problem was in wrong place for percpu_init_rwsem() call.

hci_uart_proto::open() may register a timer whose callback may call
hci_uart_tx_wakeup(). There is a chance, that hci_uart_register_device()
thread won't be fast enough to call percpu_init_rwsem().

Fix it my moving percpu_init_rwsem() call before p->open().

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 2 PID: 18524 Comm: syz-executor.5 Not tainted 5.16.0-rc6 #9
...
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 assign_lock_key kernel/locking/lockdep.c:951 [inline]
 register_lock_class+0x148d/0x1950 kernel/locking/lockdep.c:1263
 __lock_acquire+0x106/0x57e0 kernel/locking/lockdep.c:4906
 lock_acquire kernel/locking/lockdep.c:5637 [inline]
 lock_acquire+0x1ab/0x520 kernel/locking/lockdep.c:5602
 percpu_down_read_trylock include/linux/percpu-rwsem.h:92 [inline]
 hci_uart_tx_wakeup+0x12e/0x490 drivers/bluetooth/hci_ldisc.c:124
 h5_timed_event+0x32f/0x6a0 drivers/bluetooth/hci_h5.c:188
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421

Fixes: d73e172816 ("Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops")
Reported-by: Yiru Xu <xyru1999@gmail.com>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2022-01-21 23:46:48 +01:00
..
ath3k.c Bluetooth: ath3k: use usb_control_msg_send() and usb_control_msg_recv() 2020-09-25 16:33:59 +02:00
bcm203x.c Bluetooth: Use fallthrough pseudo-keyword 2020-07-10 19:09:42 +02:00
bfusb.c Bluetooth: bfusb: fix division by zero in send path 2021-10-25 15:04:46 +02:00
bluecard_cs.c Bluetooth: Use fallthrough pseudo-keyword 2020-07-10 19:09:42 +02:00
bpa10x.c Bluetooth: bpa10x: change return value 2019-09-04 16:11:46 +02:00
bt3c_cs.c Bluetooth: bt3c_cs: Fix obsolete function 2018-09-27 12:57:39 +02:00
btbcm.c Bluetooth: btbcm: disable read tx power for MacBook Air 8,1 and 8,2 2022-01-06 14:55:33 +01:00
btbcm.h Bluetooth: btbcm: Make btbcm_setup_patchram use btbcm_finalize 2020-04-22 19:43:58 +02:00
btintel.c Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products 2022-01-21 21:37:48 +01:00
btintel.h Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products 2022-01-21 21:37:48 +01:00
btmrvl_debugfs.c Bluetooth: Remove kernel-doc style comment block 2022-01-21 21:41:51 +01:00
btmrvl_drv.h Bluetooth: btmrvl: Drop unused GPIO includes 2019-01-22 09:51:20 +01:00
btmrvl_main.c Bluetooth: btmrvl_main: repair a non-kernel-doc comment 2021-11-16 15:12:05 +01:00
btmrvl_sdio.c Bluetooth: Remove kernel-doc style comment block 2022-01-21 21:41:51 +01:00
btmrvl_sdio.h
btmtk.c Bluetooth: btusb: Return error code when getting patch status failed 2021-12-07 17:05:52 +01:00
btmtk.h Bluetooth: btmtksdio: move struct reg_read_cmd to common file 2022-01-10 17:41:39 +01:00
btmtksdio.c Bluetooth: btmtksdio: clean up inconsistent error message in btmtksdio_mtk_reg_read 2022-01-10 17:41:39 +01:00
btmtkuart.c Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync 2021-09-22 16:15:54 +02:00
btqca.c Bluetooth: btqca: sequential validation 2022-01-07 08:32:55 +01:00
btqca.h Bluetooth: btqca: sequential validation 2022-01-07 08:32:55 +01:00
btqcomsmd.c Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function 2020-12-18 22:20:21 +01:00
btrsi.c Bluetooth: btrsi: remove superfluous header files from btrsi.c 2021-09-29 00:13:48 +02:00
btrtl.c Bluetooth: btrtl: Ask ic_info to drop firmware 2021-10-01 11:40:47 +02:00
btrtl.h Bluetooth: hci_h5: Add RTL8822CS capabilities 2021-06-26 07:12:34 +02:00
btsdio.c Bluetooth: btsdio: Do not bind to non-removable BCM4345 and BCM43455 2021-10-20 15:04:13 +02:00
btusb.c Bluetooth: btusb: Whitespace fixes for btusb_setup_csr() 2022-01-21 21:40:42 +01:00
dtl1_cs.c
h4_recv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
hci_ag6xx.c Bluetooth: hci_uart: Remove redundant assignment to fw_ptr 2021-06-26 07:52:41 +02:00
hci_ath.c Bluetooth: hci_uart: check for missing tty operations 2019-07-31 13:17:33 -07:00
hci_bcm.c Bluetooth: hci_bcm: Check for error irq 2022-01-06 14:52:11 +01:00
hci_bcsp.c Bluetooth: Fix invalid-free in bcsp_close() 2019-11-04 15:19:02 +01:00
hci_h4.c Bluetooth: hci_h4: Fix padding calculation error within h4_recv_buf() 2021-11-16 13:57:25 +01:00
hci_h5.c Bluetooth: hci_h5: directly return hci_uart_register_device() ret-val 2021-09-24 11:48:02 +02:00
hci_intel.c Bluetooth: btintel: Check firmware version before download 2021-03-25 16:09:35 +01:00
hci_ldisc.c TTY / Serial driver update for 5.16-rc1 2021-11-04 09:09:37 -07:00
hci_ll.c Bluetooth: Remove kernel-doc style comment block 2022-01-21 21:41:51 +01:00
hci_mrvl.c Bluetooth: hci_uart: check for missing tty operations 2019-07-31 13:17:33 -07:00
hci_nokia.c Bluetooth: hci_nokia: Save a few cycles in 'nokia_enqueue()' 2019-10-16 19:26:40 +02:00
hci_qca.c Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe 2022-01-06 14:53:57 +01:00
hci_serdev.c Bluetooth: hci_serdev: call init_rwsem() before p->open() 2022-01-21 23:46:48 +01:00
hci_uart.h Bluetooth: hci_h5: Disable the hci_suspend_notifier for btrtl devices 2021-07-22 16:06:09 +02:00
hci_vhci.c Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES 2021-12-22 23:01:35 +01:00
Kconfig Bluetooth: btmtksido: rely on BT_MTK module 2021-10-25 15:36:23 +02:00
Makefile Bluetooth: mediatek: add BT_MTK module 2021-10-25 15:36:23 +02:00
virtio_bt.c Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() 2021-10-20 14:58:46 +02:00