2023-03-09 08:07:57

by Zheng Wang

[permalink] [raw]
Subject: [PATCH] Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work

In btsdio_probe, &data->work was bound with btsdio_work.In
btsdio_send_frame, it was started by schedule_work.

If we call btsdio_remove with an unfinished job, there may
be a race condition and cause UAF bug on hdev.

Fixes: ddbaf13e3609 ("[Bluetooth] Add generic driver for Bluetooth SDIO devices")
Signed-off-by: Zheng Wang <[email protected]>
---
drivers/bluetooth/btsdio.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
index 795be33f2892..02893600db39 100644
--- a/drivers/bluetooth/btsdio.c
+++ b/drivers/bluetooth/btsdio.c
@@ -354,6 +354,7 @@ static void btsdio_remove(struct sdio_func *func)

BT_DBG("func %p", func);

+ cancel_work_sync(&data->work);
if (!data)
return;

--
2.25.1



2023-03-09 08:39:35

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work

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=728147

---Test result---

Test Summary:
CheckPatch PASS 0.71 seconds
GitLint FAIL 0.67 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 33.17 seconds
CheckAllWarning PASS 36.88 seconds
CheckSparse PASS 41.27 seconds
CheckSmatch PASS 111.11 seconds
BuildKernel32 PASS 31.87 seconds
TestRunnerSetup PASS 454.01 seconds
TestRunner_l2cap-tester PASS 16.98 seconds
TestRunner_iso-tester PASS 18.11 seconds
TestRunner_bnep-tester PASS 5.97 seconds
TestRunner_mgmt-tester PASS 114.07 seconds
TestRunner_rfcomm-tester PASS 9.41 seconds
TestRunner_sco-tester PASS 8.58 seconds
TestRunner_ioctl-tester PASS 10.01 seconds
TestRunner_mesh-tester PASS 7.37 seconds
TestRunner_smp-tester PASS 8.46 seconds
TestRunner_userchan-tester PASS 6.13 seconds
IncrementalBuild PASS 29.68 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (81>80): "Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work"


---
Regards,
Linux Bluetooth

2023-03-14 23:10:39

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Thu, 9 Mar 2023 16:07:39 +0800 you wrote:
> In btsdio_probe, &data->work was bound with btsdio_work.In
> btsdio_send_frame, it was started by schedule_work.
>
> If we call btsdio_remove with an unfinished job, there may
> be a race condition and cause UAF bug on hdev.
>
> Fixes: ddbaf13e3609 ("[Bluetooth] Add generic driver for Bluetooth SDIO devices")
> Signed-off-by: Zheng Wang <[email protected]>
>
> [...]

Here is the summary with links:
- Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work
https://git.kernel.org/bluetooth/bluetooth-next/c/f132c2d13088

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html