This use-after-free has been reported as a security bug (b/328916844 for Googlers).
Our initial minimally invasive patch:
This code needs a major refactor and shouldn't be using raw pointers, but we want to avoid introducing new bugs with a quick patch.
Android has ported a lot of the Bluetooth code to Rust. This is a demonstration of why they need to put more resources into porting the rest of the code into Rust.
They should also be testing HWASan and MTE builds with more real world usage including using assorted BT devices.
GrapheneOS is the first platform using MTE in production, and does a lot more too:
https://grapheneos.org/features#exploit-protection
Our Vanadium browser is the first browser using it in prod:
https://grapheneos.org/features#vanadium
We plan to add stack MTE, improve PartitionAlloc and make new kernel slab MTE.
This issue was fixed in the March 9th release of GrapheneOS:
https://grapheneos.org/releases#2024030900
We also reported it as an Android vulnerability in the same day and it has been initially triaged as a High severity and High quality report.
We're working on additional reports from users.