All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend
@ 2024-07-16  7:49 Chris Lu
  2024-07-16  8:38 ` [v1] " bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Lu @ 2024-07-16  7:49 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
  Cc: Sean Wang, Aaron Hou, Steve Lee, linux-bluetooth, linux-kernel,
	linux-mediatek, Chris Lu

If MediaTek's Bluetooth setup is unsuccessful, a NULL pointer issue
occur when the system is suspended and the anchored kill function
is called. To avoid this, add protection to prevent executing the
anchored kill function if the setup is unsuccessful.

[    6.922106] Hardware name: Acer Tomato (rev2) board (DT)
[    6.922114] Workqueue: pm pm_runtime_work
[    6.922132] pstate: 804000c9
(Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    6.922147] pc : usb_kill_anchored_urbs+0x6c/0x1e0
[    6.922164] lr : usb_kill_anchored_urbs+0x48/0x1e0
[    6.922181] sp : ffff800080903b60
[    6.922187] x29: ffff800080903b60
x28: ffff2c7b85c32b80 x27: ffff2c7bbb370930
[    6.922211] x26: 00000000000f4240
x25: 00000000ffffffff x24: ffffd49ece2dcb48
[    6.922255] x20: ffffffffffffffd8
x19: 0000000000000000 x18: 0000000000000006
[    6.922276] x17: 6531656337386238
x16: 3632373862333863 x15: ffff800080903480
[    6.922297] x14: 0000000000000000
x13: 303278302f303178 x12: ffffd49ecf090e30
[    6.922318] x11: 0000000000000001
x10: 0000000000000001 x9 : ffffd49ecd2c5bb4
[    6.922339] x8 : c0000000ffffdfff
x7 : ffffd49ecefe0db8 x6 : 00000000000affa8
[    6.922360] x5 : ffff2c7bbb35dd48
x4 : 0000000000000000 x3 : 0000000000000000
[    6.922379] x2 : 0000000000000000
x1 : 0000000000000003 x0 : ffffffffffffffd8
[    6.922400] Call trace:
[    6.922405]  usb_kill_anchored_urbs+0x6c/0x1e0
[    6.922422]  btmtk_usb_suspend+0x20/0x38
[btmtk 5f200a97badbdfda4266773fee49acfc8e0224d5]
[    6.922444]  btusb_suspend+0xd0/0x210
[btusb 0bfbf19a87ff406c83b87268b87ce1e80e9a829b]
[    6.922469]  usb_suspend_both+0x90/0x288
[    6.922487]  usb_runtime_suspend+0x3c/0xa8
[    6.922507]  __rpm_callback+0x50/0x1f0
[    6.922523]  rpm_callback+0x70/0x88
[    6.922538]  rpm_suspend+0xe4/0x5a0
[    6.922553]  pm_runtime_work+0xd4/0xe0
[    6.922569]  process_one_work+0x18c/0x440
[    6.922588]  worker_thread+0x314/0x428
[    6.922606]  kthread+0x128/0x138
[    6.922621]  ret_from_fork+0x10/0x20
[    6.922644] Code: f100a274 54000520 d503201f d100a260 (b8370000)
[    6.922654] ---[ end trace 0000000000000000 ]---

Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
---
 drivers/bluetooth/btmtk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index b7c348687a77..191bc6925120 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -1262,7 +1262,8 @@ int btmtk_usb_suspend(struct hci_dev *hdev)
 	struct btmtk_data *btmtk_data = hci_get_priv(hdev);
 
 	/* Stop urb anchor for iso data transmission */
-	usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
+	if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
+		usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
 
 	return 0;
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend
  2024-07-16  7:49 [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend Chris Lu
@ 2024-07-16  8:38 ` bluez.test.bot
  2024-07-16 13:15 ` [PATCH v1] " Nícolas F. R. A. Prado
  2024-07-16 19:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-07-16  8:38 UTC (permalink / raw)
  To: linux-bluetooth, chris.lu

[-- Attachment #1: Type: text/plain, Size: 1697 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=871587

---Test result---

Test Summary:
CheckPatch                    PASS      0.67 seconds
GitLint                       PASS      0.32 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      29.34 seconds
CheckAllWarning               PASS      32.01 seconds
CheckSparse                   PASS      39.47 seconds
CheckSmatch                   PASS      102.91 seconds
BuildKernel32                 PASS      29.24 seconds
TestRunnerSetup               PASS      525.46 seconds
TestRunner_l2cap-tester       PASS      24.08 seconds
TestRunner_iso-tester         PASS      32.86 seconds
TestRunner_bnep-tester        PASS      4.92 seconds
TestRunner_mgmt-tester        FAIL      113.69 seconds
TestRunner_rfcomm-tester      PASS      7.42 seconds
TestRunner_sco-tester         PASS      15.09 seconds
TestRunner_ioctl-tester       PASS      7.86 seconds
TestRunner_mesh-tester        PASS      5.99 seconds
TestRunner_smp-tester         PASS      6.94 seconds
TestRunner_userchan-tester    PASS      5.12 seconds
IncrementalBuild              PASS      27.08 seconds

Details
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 489 (99.4%), Failed: 1, Not Run: 2

Failed Test Cases
Pairing Acceptor - SMP over BR/EDR 1                 Timed out    2.519 seconds


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend
  2024-07-16  7:49 [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend Chris Lu
  2024-07-16  8:38 ` [v1] " bluez.test.bot
@ 2024-07-16 13:15 ` Nícolas F. R. A. Prado
  2024-07-16 19:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-07-16 13:15 UTC (permalink / raw)
  To: Chris Lu
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz, Sean Wang,
	Aaron Hou, Steve Lee, linux-bluetooth, linux-kernel,
	linux-mediatek

On Tue, Jul 16, 2024 at 03:49:47PM +0800, Chris Lu wrote:
> If MediaTek's Bluetooth setup is unsuccessful, a NULL pointer issue
> occur when the system is suspended and the anchored kill function
> is called. To avoid this, add protection to prevent executing the
> anchored kill function if the setup is unsuccessful.
> 
> [    6.922106] Hardware name: Acer Tomato (rev2) board (DT)
> [    6.922114] Workqueue: pm pm_runtime_work
> [    6.922132] pstate: 804000c9
> (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [    6.922147] pc : usb_kill_anchored_urbs+0x6c/0x1e0
> [    6.922164] lr : usb_kill_anchored_urbs+0x48/0x1e0
> [    6.922181] sp : ffff800080903b60
> [    6.922187] x29: ffff800080903b60
> x28: ffff2c7b85c32b80 x27: ffff2c7bbb370930
> [    6.922211] x26: 00000000000f4240
> x25: 00000000ffffffff x24: ffffd49ece2dcb48
> [    6.922255] x20: ffffffffffffffd8
> x19: 0000000000000000 x18: 0000000000000006
> [    6.922276] x17: 6531656337386238
> x16: 3632373862333863 x15: ffff800080903480
> [    6.922297] x14: 0000000000000000
> x13: 303278302f303178 x12: ffffd49ecf090e30
> [    6.922318] x11: 0000000000000001
> x10: 0000000000000001 x9 : ffffd49ecd2c5bb4
> [    6.922339] x8 : c0000000ffffdfff
> x7 : ffffd49ecefe0db8 x6 : 00000000000affa8
> [    6.922360] x5 : ffff2c7bbb35dd48
> x4 : 0000000000000000 x3 : 0000000000000000
> [    6.922379] x2 : 0000000000000000
> x1 : 0000000000000003 x0 : ffffffffffffffd8
> [    6.922400] Call trace:
> [    6.922405]  usb_kill_anchored_urbs+0x6c/0x1e0
> [    6.922422]  btmtk_usb_suspend+0x20/0x38
> [btmtk 5f200a97badbdfda4266773fee49acfc8e0224d5]
> [    6.922444]  btusb_suspend+0xd0/0x210
> [btusb 0bfbf19a87ff406c83b87268b87ce1e80e9a829b]
> [    6.922469]  usb_suspend_both+0x90/0x288
> [    6.922487]  usb_runtime_suspend+0x3c/0xa8
> [    6.922507]  __rpm_callback+0x50/0x1f0
> [    6.922523]  rpm_callback+0x70/0x88
> [    6.922538]  rpm_suspend+0xe4/0x5a0
> [    6.922553]  pm_runtime_work+0xd4/0xe0
> [    6.922569]  process_one_work+0x18c/0x440
> [    6.922588]  worker_thread+0x314/0x428
> [    6.922606]  kthread+0x128/0x138
> [    6.922621]  ret_from_fork+0x10/0x20
> [    6.922644] Code: f100a274 54000520 d503201f d100a260 (b8370000)
> [    6.922654] ---[ end trace 0000000000000000 ]---
> 
> Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
> Signed-off-by: Chris Lu <chris.lu@mediatek.com>

Hi Chris,

thank you for the patch. Please add the following tags:

Reported-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> #KernelCI
Closes: https://lore.kernel.org/all/7851401b-e884-4ed4-998d-7651f427ad37@notapiano

Those will make it easier to find the bug report and also make sure regzbot
closes the issue once the patch is merged.

I've tested this patch and indeed it fixes the issue, so please also add

Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Thanks,
Nícolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend
  2024-07-16  7:49 [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend Chris Lu
  2024-07-16  8:38 ` [v1] " bluez.test.bot
  2024-07-16 13:15 ` [PATCH v1] " Nícolas F. R. A. Prado
@ 2024-07-16 19:30 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-07-16 19:30 UTC (permalink / raw)
  To: =?utf-8?b?Q2hyaXMgTHUgKOmZuOeomuazkykgPGNocmlzLmx1QG1lZGlhdGVrLmNvbT4=?=
  Cc: marcel, johan.hedberg, luiz.dentz, sean.wang, aaron.hou,
	steve.lee, linux-bluetooth, linux-kernel, linux-mediatek

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 16 Jul 2024 15:49:47 +0800 you wrote:
> If MediaTek's Bluetooth setup is unsuccessful, a NULL pointer issue
> occur when the system is suspended and the anchored kill function
> is called. To avoid this, add protection to prevent executing the
> anchored kill function if the setup is unsuccessful.
> 
> [    6.922106] Hardware name: Acer Tomato (rev2) board (DT)
> [    6.922114] Workqueue: pm pm_runtime_work
> [    6.922132] pstate: 804000c9
> (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [    6.922147] pc : usb_kill_anchored_urbs+0x6c/0x1e0
> [    6.922164] lr : usb_kill_anchored_urbs+0x48/0x1e0
> [    6.922181] sp : ffff800080903b60
> [    6.922187] x29: ffff800080903b60
> x28: ffff2c7b85c32b80 x27: ffff2c7bbb370930
> [    6.922211] x26: 00000000000f4240
> x25: 00000000ffffffff x24: ffffd49ece2dcb48
> [    6.922255] x20: ffffffffffffffd8
> x19: 0000000000000000 x18: 0000000000000006
> [    6.922276] x17: 6531656337386238
> x16: 3632373862333863 x15: ffff800080903480
> [    6.922297] x14: 0000000000000000
> x13: 303278302f303178 x12: ffffd49ecf090e30
> [    6.922318] x11: 0000000000000001
> x10: 0000000000000001 x9 : ffffd49ecd2c5bb4
> [    6.922339] x8 : c0000000ffffdfff
> x7 : ffffd49ecefe0db8 x6 : 00000000000affa8
> [    6.922360] x5 : ffff2c7bbb35dd48
> x4 : 0000000000000000 x3 : 0000000000000000
> [    6.922379] x2 : 0000000000000000
> x1 : 0000000000000003 x0 : ffffffffffffffd8
> [    6.922400] Call trace:
> [    6.922405]  usb_kill_anchored_urbs+0x6c/0x1e0
> [    6.922422]  btmtk_usb_suspend+0x20/0x38
> [btmtk 5f200a97badbdfda4266773fee49acfc8e0224d5]
> [    6.922444]  btusb_suspend+0xd0/0x210
> [btusb 0bfbf19a87ff406c83b87268b87ce1e80e9a829b]
> [    6.922469]  usb_suspend_both+0x90/0x288
> [    6.922487]  usb_runtime_suspend+0x3c/0xa8
> [    6.922507]  __rpm_callback+0x50/0x1f0
> [    6.922523]  rpm_callback+0x70/0x88
> [    6.922538]  rpm_suspend+0xe4/0x5a0
> [    6.922553]  pm_runtime_work+0xd4/0xe0
> [    6.922569]  process_one_work+0x18c/0x440
> [    6.922588]  worker_thread+0x314/0x428
> [    6.922606]  kthread+0x128/0x138
> [    6.922621]  ret_from_fork+0x10/0x20
> [    6.922644] Code: f100a274 54000520 d503201f d100a260 (b8370000)
> [    6.922654] ---[ end trace 0000000000000000 ]---
> 
> [...]

Here is the summary with links:
  - [v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend
    https://git.kernel.org/bluetooth/bluetooth-next/c/0c9b6e2f7742

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] 4+ messages in thread

end of thread, other threads:[~2024-07-16 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16  7:49 [PATCH v1] Bluetooth: btmtk: Fix kernel crash when entering btmtk_usb_suspend Chris Lu
2024-07-16  8:38 ` [v1] " bluez.test.bot
2024-07-16 13:15 ` [PATCH v1] " Nícolas F. R. A. Prado
2024-07-16 19:30 ` 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.