android_kernel_motorola_sm6375/drivers/bluetooth
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Pavel Skripkin d58d281d6a Bluetooth: hci_serdev: call init_rwsem() before p->open()
[ Upstream commit 9d7cbe2b9cf5f650067df4f402fdd799d4bbb4e1 ]

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 <[email protected]>
Signed-off-by: Pavel Skripkin <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2022-04-15 14:18:10 +02:00
..
ath3k.c
bcm203x.c
bfusb.c Bluetooth: bfusb: fix division by zero in send path 2022-01-16 09:15:38 +01:00
bluecard_cs.c
bpa10x.c
bt3c_cs.c
btbcm.c
btbcm.h
btintel.c
btintel.h
btmrvl_debugfs.c
btmrvl_drv.h
btmrvl_main.c
btmrvl_sdio.c btmrvl: Fix firmware filename for sd8997 chipset 2020-08-19 08:16:06 +02:00
btmrvl_sdio.h
btmtksdio.c Bluetooth: btmtksdio: fix resume failure 2022-01-27 09:19:32 +01:00
btmtkuart.c Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync 2021-11-17 09:48:34 +01:00
btqca.c
btqca.h
btqcomsmd.c Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function 2021-03-04 10:26:11 +01:00
btrsi.c
btrtl.c Bluetooth: btrtl: Use kvmalloc for FW allocations 2020-10-01 13:17:29 +02:00
btrtl.h
btsdio.c
btusb.c Bluetooth: btusb: fix memory leak in btusb_mtk_submit_wmt_recv_urb() 2022-01-16 09:15:38 +01:00
btwilink.c
dtl1_cs.c
h4_recv.h
hci_ag6xx.c
hci_ath.c
hci_bcm.c Bluetooth: hci_bcm: Check for error irq 2022-01-27 09:19:36 +01:00
hci_bcsp.c
hci_h4.c
hci_h5.c Bluetooth: hci_h5: Set HCI_QUIRK_SIMULTANEOUS_DISCOVERY for btrtl 2021-03-07 12:20:44 +01:00
hci_intel.c
hci_ldisc.c Bluetooth: hci_uart: Fix a race for write_work scheduling 2021-03-04 10:26:11 +01:00
hci_ll.c
hci_mrvl.c
hci_nokia.c
hci_qca.c
hci_serdev.c Bluetooth: hci_serdev: call init_rwsem() before p->open() 2022-04-15 14:18:10 +02:00
hci_uart.h
hci_vhci.c
Kconfig
Makefile