linux-stable/drivers/bluetooth
Yake Yang 770a97d3f3 Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt
[ Upstream commit b062a0b9c1 ]

Fix the following kernel oops in btmtksdio_interrrupt

[   14.339134]  btmtksdio_interrupt+0x28/0x54
[   14.339139]  process_sdio_pending_irqs+0x68/0x1a0
[   14.339144]  sdio_irq_work+0x40/0x70
[   14.339154]  process_one_work+0x184/0x39c
[   14.339160]  worker_thread+0x228/0x3e8
[   14.339168]  kthread+0x148/0x3ac
[   14.339176]  ret_from_fork+0x10/0x30

That happened because hdev->power_on is already called before
sdio_set_drvdata which btmtksdio_interrupt handler relies on is not
properly set up.

The details are shown as the below: hci_register_dev would run
queue_work(hdev->req_workqueue, &hdev->power_on) as WQ_HIGHPRI
workqueue_struct to complete the power-on sequeunce and thus hci_power_on
may run before sdio_set_drvdata is done in btmtksdio_probe.

The hci_dev_do_open in hci_power_on would initialize the device and enable
the interrupt and thus it is possible that btmtksdio_interrupt is being
called right before sdio_set_drvdata is filled out.

When btmtksdio_interrupt is being called and sdio_set_drvdata is not filled
, the kernel oops is going to happen because btmtksdio_interrupt access an
uninitialized pointer.

Fixes: 9aebfd4a22 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices")
Reviewed-by: Mark Chen <markyawenchen@gmail.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:41 +02:00
..
ath3k.c
bcm203x.c
bfusb.c Bluetooth: bfusb: fix division by zero in send path 2022-01-16 09:12:43 +01:00
bluecard_cs.c
bpa10x.c
bt3c_cs.c
btbcm.c Bluetooth: btbcm: disable read tx power for MacBook Air 8,1 and 8,2 2022-01-16 09:12:44 +01:00
btbcm.h
btintel.c Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products 2022-04-08 14:23:24 +02:00
btintel.h Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products 2022-04-08 14:23:24 +02:00
btmrvl_debugfs.c
btmrvl_drv.h
btmrvl_main.c
btmrvl_sdio.c Bluetooth: btmrvl_sdio: Remove all strcpy() uses 2021-07-29 13:46:13 +02:00
btmrvl_sdio.h
btmtksdio.c Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt 2022-04-08 14:23:41 +02:00
btmtkuart.c Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync 2021-11-18 19:16:24 +01:00
btqca.c Bluetooth: btqca: Moved extracting rom version info to common place 2021-06-26 07:12:30 +02:00
btqca.h Bluetooth: btqca: Add support for firmware image with mbn type for WCN6750 2021-06-26 07:12:29 +02:00
btqcomsmd.c
btrsi.c Bluetooth: btrsi: use non-kernel-doc comment for copyright 2021-07-22 16:35:46 +02:00
btrtl.c Bluetooth: btrtl: Set MSFT opcode for RTL8852 2021-07-22 16:20:27 +02:00
btrtl.h Bluetooth: hci_h5: Add RTL8822CS capabilities 2021-06-26 07:12:34 +02:00
btsdio.c
btusb.c Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products 2022-04-08 14:23:24 +02:00
dtl1_cs.c
h4_recv.h
hci_ag6xx.c Bluetooth: hci_uart: Remove redundant assignment to fw_ptr 2021-06-26 07:52:41 +02:00
hci_ath.c
hci_bcm.c Bluetooth: hci_bcm: Check for error irq 2022-01-27 11:03:53 +01:00
hci_bcsp.c
hci_h4.c
hci_h5.c Bluetooth: hci_uart: add missing NULL check in h5_enqueue 2022-04-08 14:23:41 +02:00
hci_intel.c Bluetooth: btintel: Check firmware version before download 2021-03-25 16:09:35 +01:00
hci_ldisc.c tty: no checking of tty_unregister_ldisc 2021-05-13 16:57:17 +02:00
hci_ll.c
hci_mrvl.c
hci_nokia.c
hci_qca.c Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe 2022-01-27 11:03:53 +01:00
hci_serdev.c Bluetooth: hci_serdev: call init_rwsem() before p->open() 2022-04-08 14:23:25 +02: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 2022-01-27 11:04:49 +01:00
Kconfig Bluetooth: Add support for virtio transport driver 2021-04-08 12:26:34 +02:00
Makefile Bluetooth: Add support for virtio transport driver 2021-04-08 12:26:34 +02:00
virtio_bt.c Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() 2022-01-27 11:03:03 +01:00