diff mbox series

Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work

Message ID 20230309080739.3714610-1-zyytlz.wz@163.com (mailing list archive)
State Accepted
Commit f132c2d1308895b0a10e0f0c5f9f25e680777913
Headers show
Series Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint fail 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"
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Zheng Wang March 9, 2023, 8:07 a.m. UTC
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 <zyytlz.wz@163.com>
---
 drivers/bluetooth/btsdio.c | 1 +
 1 file changed, 1 insertion(+)

Comments

bluez.test.bot@gmail.com March 9, 2023, 8:37 a.m. UTC | #1
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
patchwork-bot+bluetooth@kernel.org March 14, 2023, 11:10 p.m. UTC | #2
Hello:

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

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 <zyytlz.wz@163.com>
> 
> [...]

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!
diff mbox series

Patch

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;