* [PATCH v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
@ 2022-05-11 22:22 ` sean.wang
0 siblings, 0 replies; 5+ messages in thread
From: sean.wang @ 2022-05-11 22:22 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Eric.Liang, Stella.Chang, Tom.Chou, steve.lee, jsiuda,
frankgor, abhishekpandit, michaelfsun, mcchou, shawnku,
linux-bluetooth, linux-mediatek, linux-kernel, Yake Yang
From: Sean Wang <sean.wang@mediatek.com>
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: 9aebfd4a2200 ("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>
---
v2: add Fixes tag
---
drivers/bluetooth/btmtksdio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index b6d77e04240c..4ae6631a7c29 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -379,6 +379,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
struct hci_event_hdr *hdr = (void *)skb->data;
+ u8 evt = hdr->evt;
int err;
/* When someone waits for the WMT event, the skb is being cloned
@@ -396,7 +397,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
if (err < 0)
goto err_free_skb;
- if (hdr->evt == HCI_EV_WMT) {
+ if (evt == HCI_EV_WMT) {
if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
&bdev->tx_state)) {
/* Barrier to sync with other CPUs */
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
@ 2022-05-11 22:22 ` sean.wang
0 siblings, 0 replies; 5+ messages in thread
From: sean.wang @ 2022-05-11 22:22 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
ted.huang, Eric.Liang, Stella.Chang, Tom.Chou, steve.lee, jsiuda,
frankgor, abhishekpandit, michaelfsun, mcchou, shawnku,
linux-bluetooth, linux-mediatek, linux-kernel, Yake Yang
From: Sean Wang <sean.wang@mediatek.com>
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: 9aebfd4a2200 ("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>
---
v2: add Fixes tag
---
drivers/bluetooth/btmtksdio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index b6d77e04240c..4ae6631a7c29 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -379,6 +379,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
struct hci_event_hdr *hdr = (void *)skb->data;
+ u8 evt = hdr->evt;
int err;
/* When someone waits for the WMT event, the skb is being cloned
@@ -396,7 +397,7 @@ static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
if (err < 0)
goto err_free_skb;
- if (hdr->evt == HCI_EV_WMT) {
+ if (evt == HCI_EV_WMT) {
if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
&bdev->tx_state)) {
/* Barrier to sync with other CPUs */
--
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
2022-05-11 22:22 ` sean.wang
(?)
@ 2022-05-11 23:03 ` bluez.test.bot
-1 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-05-11 23:03 UTC (permalink / raw)
To: linux-bluetooth, sean.wang
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=640728
---Test result---
Test Summary:
CheckPatch PASS 1.63 seconds
GitLint PASS 1.00 seconds
SubjectPrefix PASS 0.86 seconds
BuildKernel PASS 32.04 seconds
BuildKernel32 PASS 28.78 seconds
Incremental Build with patchesPASS 38.19 seconds
TestRunner: Setup PASS 474.64 seconds
TestRunner: l2cap-tester PASS 17.45 seconds
TestRunner: bnep-tester PASS 6.08 seconds
TestRunner: mgmt-tester PASS 102.23 seconds
TestRunner: rfcomm-tester PASS 9.63 seconds
TestRunner: sco-tester PASS 9.50 seconds
TestRunner: smp-tester PASS 9.51 seconds
TestRunner: userchan-tester PASS 6.40 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
2022-05-11 22:22 ` sean.wang
@ 2022-05-13 11:21 ` patchwork-bot+bluetooth
-1 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-05-13 11:21 UTC (permalink / raw)
To: Sean Wang
Cc: marcel, johan.hedberg, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, abhishekpandit, michaelfsun, mcchou,
shawnku, linux-bluetooth, linux-mediatek, linux-kernel,
yake.yang
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:
On Thu, 12 May 2022 06:22:15 +0800 you wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> 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)
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
https://git.kernel.org/bluetooth/bluetooth-next/c/0fab6361c4ba
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
@ 2022-05-13 11:21 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-05-13 11:21 UTC (permalink / raw)
To: Sean Wang
Cc: marcel, johan.hedberg, Soul.Huang, YN.Chen, Leon.Yen,
Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh,
posh.sun, ted.huang, Eric.Liang, Stella.Chang, Tom.Chou,
steve.lee, jsiuda, frankgor, abhishekpandit, michaelfsun, mcchou,
shawnku, linux-bluetooth, linux-mediatek, linux-kernel,
yake.yang
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:
On Thu, 12 May 2022 06:22:15 +0800 you wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> 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)
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event
https://git.kernel.org/bluetooth/bluetooth-next/c/0fab6361c4ba
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-13 11:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 22:22 [PATCH v2] Bluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event sean.wang
2022-05-11 22:22 ` sean.wang
2022-05-11 23:03 ` [v2] " bluez.test.bot
2022-05-13 11:21 ` [PATCH v2] " patchwork-bot+bluetooth
2022-05-13 11:21 ` patchwork-bot+bluetooth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.