kernel_optimize_test/drivers/bluetooth
Yake Yang 70a6cf749d Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt
[ Upstream commit b062a0b9c1dc1ff63094337dccfe1568d5b62023 ]

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:40:22 +02: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
bfusb.c Bluetooth: bfusb: fix division by zero in send path 2022-01-16 09:14:22 +01:00
bluecard_cs.c
bpa10x.c
bt3c_cs.c
btbcm.c
btbcm.h
btintel.c Bluetooth: btintel: Functions to send firmware header / payload 2020-09-14 20:30:36 +02:00
btintel.h Bluetooth: btintel: Replace zero-length array with flexible-array member 2020-10-30 16:57:41 -05:00
btmrvl_debugfs.c
btmrvl_drv.h
btmrvl_main.c
btmrvl_sdio.c
btmrvl_sdio.h
btmtksdio.c Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt 2022-04-08 14:40:22 +02:00
btmtkuart.c Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync 2021-11-18 14:04:03 +01:00
btqca.c Bluetooth: btqca: Don't modify firmware contents in-place 2021-07-14 16:55:34 +02:00
btqca.h
btqcomsmd.c Bluetooth: btqcomsmd: Fix a resource leak in error handling paths in the probe function 2021-03-04 11:37:20 +01:00
btrsi.c
btrtl.c
btrtl.h
btsdio.c
btusb.c Bluetooth: btusb: Add support for Foxconn QCA 0xe0d0 2022-01-16 09:14:22 +01:00
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 10:54:01 +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:34:09 +01:00
hci_intel.c Bluetooth: hci_intel: enable on new platform 2020-09-11 09:03:42 +02:00
hci_ldisc.c tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer 2021-03-04 11:37:36 +01: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 10:54:01 +01:00
hci_serdev.c Bluetooth: hci_serdev: call init_rwsem() before p->open() 2022-04-08 14:40:12 +02:00
hci_uart.h
hci_vhci.c Bluetooth: vhci: Set HCI_QUIRK_VALID_LE_STATES 2022-01-27 10:54:18 +01:00
Kconfig
Makefile