Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: A2DP: Fix NULL pointer references issue #75367

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

lylezhu2012
Copy link
Contributor

The opposite logic is used to determine if a pointer is valid.

Correct the judgement logic.

Fixes #74728.

The opposite logic is used to determine if a
pointer is valid.

Correct the judgment logic.

Fixes #74728.

Signed-off-by: Lyle Zhu <[email protected]>
@jhedberg
Copy link
Member

jhedberg commented Jul 3, 2024

I think the more worrying thing here is that it seems this code was never tested. Otherwise you'd get NULL dereferences immediately.

@Thalley
Copy link
Collaborator

Thalley commented Jul 3, 2024

I think the more worrying thing here is that it seems this code was never tested. Otherwise you'd get NULL dereferences immediately.

Indeed. BSIM can't test BREDR right? So for classic we should probably start implementing/requesting unit tests at the very least.

@jhedberg
Copy link
Member

jhedberg commented Jul 3, 2024

BSIM can't test BREDR right? So for classic we should probably start implementing/requesting unit tests at the very least.

Yep. One alternative to explore for runtime testing, would be to use the BlueZ btvirt tool to create multiple virtual dual-mode controllers. btvirt makes the controllers "reachable" to each other, so you'd start one qemu instance per controller and then set one as connectable + discoverable and another to then try to connect to the first one and do some A2DP or other Bluetooth Classic protocol communication between them. That's a rather big effort of its own, but if @lylezhu2012 or anyone else with a stake in Bluetooth Classic is interested it might be the shortest path to get some runtime testing in our CI.

@Thalley
Copy link
Collaborator

Thalley commented Jul 3, 2024

BSIM can't test BREDR right? So for classic we should probably start implementing/requesting unit tests at the very least.

Yep. One alternative to explore for runtime testing, would be to use the BlueZ btvirt tool to create multiple virtual dual-mode controllers. btvirt makes the controllers "reachable" to each other, so you'd start one qemu instance per controller and then set one as connectable + discoverable and another to then try to connect to the first one and do some A2DP or other Bluetooth Classic protocol communication between them. That's a rather big effort of its own, but if @lylezhu2012 or anyone else with a stake in Bluetooth Classic is interested it might be the shortest path to get some runtime testing in our CI.

Cool

We should at least look for some useful approach for testing classic in CI, otherwise it'll just end up broken periodically.

Adding support for it in BSIM would probably be ideal - Then we could also start working towards some dual-mode tests, but I assume that's also a significant effort right @aescolar ?

@lylezhu2012
Copy link
Contributor Author

BSIM can't test BREDR right? So for classic we should probably start implementing/requesting unit tests at the very least.

Yep. One alternative to explore for runtime testing, would be to use the BlueZ btvirt tool to create multiple virtual dual-mode controllers. btvirt makes the controllers "reachable" to each other, so you'd start one qemu instance per controller and then set one as connectable + discoverable and another to then try to connect to the first one and do some A2DP or other Bluetooth Classic protocol communication between them. That's a rather big effort of its own, but if @lylezhu2012 or anyone else with a stake in Bluetooth Classic is interested it might be the shortest path to get some runtime testing in our CI.

Yes. In the short term, I hope to enable pts test, which is what I am doing. In this way, we can ensure the most basic quality. Then, we plan implement BSIM-like testing based on twister.

@aescolar
Copy link
Member

aescolar commented Jul 3, 2024

Then we could also start working towards some dual-mode tests, but I assume that's also a significant effort right @aescolar ?

Correct. Classic BT is not currently supported, and there is no plans for it, and I doubt Nordic will have a motivation to pay for that development :)

@aescolar aescolar merged commit 8276d4f into zephyrproject-rtos:main Jul 5, 2024
34 checks passed
@aescolar aescolar added this to the v3.7.0 milestone Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Classic area: Bluetooth Controller area: Bluetooth Host area: Bluetooth size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Coverity CID: 392496] Dereference after null check in subsys/bluetooth/host/classic/a2dp.c
6 participants