linux-stable/drivers/bluetooth
Sean Wang 02ba31e09a Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
[ Upstream commit 0fab6361c4 ]

We should not access skb buffer data anymore after hci_recv_frame was
called.

[   39.634809] BUG: KASAN: use-after-free in btmtksdio_recv_event+0x1b0
[   39.634855] Read of size 1 at addr ffffff80cf28a60d by task kworker
[   39.634962] Call trace:
[   39.634974]  dump_backtrace+0x0/0x3b8
[   39.634999]  show_stack+0x20/0x2c
[   39.635016]  dump_stack_lvl+0x60/0x78
[   39.635040]  print_address_description+0x70/0x2f0
[   39.635062]  kasan_report+0x154/0x194
[   39.635079]  __asan_report_load1_noabort+0x44/0x50
[   39.635099]  btmtksdio_recv_event+0x1b0/0x1c4
[   39.635129]  btmtksdio_txrx_work+0x6cc/0xac4
[   39.635157]  process_one_work+0x560/0xc5c
[   39.635177]  worker_thread+0x7ec/0xcc0
[   39.635195]  kthread+0x2d0/0x3d0
[   39.635215]  ret_from_fork+0x10/0x20
[   39.635247] Allocated by task 0:
[   39.635260] (stack is not available)
[   39.635281] Freed by task 2392:
[   39.635295]  kasan_save_stack+0x38/0x68
[   39.635319]  kasan_set_track+0x28/0x3c
[   39.635338]  kasan_set_free_info+0x28/0x4c
[   39.635357]  ____kasan_slab_free+0x104/0x150
[   39.635374]  __kasan_slab_free+0x18/0x28
[   39.635391]  slab_free_freelist_hook+0x114/0x248
[   39.635410]  kfree+0xf8/0x2b4
[   39.635427]  skb_free_head+0x58/0x98
[   39.635447]  skb_release_data+0x2f4/0x410
[   39.635464]  skb_release_all+0x50/0x60
[   39.635481]  kfree_skb+0xc8/0x25c
[   39.635498]  hci_event_packet+0x894/0xca4 [bluetooth]
[   39.635721]  hci_rx_work+0x1c8/0x68c [bluetooth]
[   39.635925]  process_one_work+0x560/0xc5c
[   39.635951]  worker_thread+0x7ec/0xcc0
[   39.635970]  kthread+0x2d0/0x3d0
[   39.635990]  ret_from_fork+0x10/0x20
[   39.636021] The buggy address belongs to the object at ffffff80cf28a600
                which belongs to the cache kmalloc-512 of size 512
[   39.636039] The buggy address is located 13 bytes inside of
                512-byte region [ffffff80cf28a600, ffffff80cf28a800)

Fixes: 9aebfd4a22 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices")
Co-developed-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:25:52 +02: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
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-04-08 13:57:56 +02:00
btintel.h Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products 2022-04-08 13:57:56 +02:00
btmrvl_debugfs.c
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: btmrvl_sdio: Remove all strcpy() uses 2021-07-29 13:46:13 +02: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: mediatek: fix the conflict between mtk and msft vendor event 2022-04-13 19:27:19 +02:00
btmtksdio.c Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event 2022-06-09 10:25:52 +02: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: Set HCI_QUIRK_BROKEN_ERR_DATA_REPORTING for QCA 2022-06-09 10:25:28 +02: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_uart: add missing NULL check in h5_enqueue 2022-04-08 13:58:20 +02:00
hci_intel.c Bluetooth: btintel: Check firmware version before download 2021-03-25 16:09:35 +01:00
hci_ldisc.c tty: remove file from tty_ldisc_ops::ioctl and compat_ioctl 2021-11-25 18:36:27 +01:00
hci_ll.c Bluetooth: hci_ll: add a small delay for wl1271 enable bt_en 2020-11-11 10:57:36 +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: Use del_timer_sync() before freeing 2022-06-06 08:47:54 +02:00
hci_serdev.c Bluetooth: hci_serdev: call init_rwsem() before p->open() 2022-04-08 13:57:56 +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 2021-12-22 23:01:35 +01:00
virtio_bt.c virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00