fix(core/bootloader): initialize BLE once on the wipe path [no changelog]
What changed, and why it matters
This is a small bug fix in the Trezor bootloader's wipe feature. When wiping the device, the code was accidentally initializing the Bluetooth (BLE) system twice. On real hardware the second call was ignored, but in the software emulator it caused the wipe process to end on an error screen. The patch removes the redundant second initialization and also makes the emulator's BLE driver ignore repeated initializations, matching the real hardware behavior. It does not appear to be a security vulnerability.
Treat as a routine functional fix. No security response required. Reviewers may verify that the unix BLE driver's initialized flag is correctly set and cleared elsewhere to prevent state inconsistency.
Security signals we found
No memory safety, authentication, cryptographic, or privilege-escalation issues visible in diff
Change is defensive hardening against double-initialization rather than an exploit path
Failure mode was a functional error screen in emulator, not a security bypass
No changelog entry suggests routine bug fix
Evidence from the diff
In bootloader_main(), the wipe path called ble_init() even though drivers_init() had already initialized BLE. The STM32 driver silently tolerated the redundant call, but the unix BLE driver re-registered handles and failed, causing emulator wipe boots to land on the failure screen. The fix removes the extra ble_init() in bootloader_main() and adds an already-initialized guard (drv->initialized check) to the unix ble_init() implementation before it zeroes the driver and re-creates sockets.
Changed components
core/embed/projects/bootloader/main.ccore/embed/io/ble/unix/ble.cInspect captured patch +5 / −1
### core/embed/io/ble/unix/ble.c
@@ -110,6 +110,11 @@ static bool is_enabled(const ble_driver_t *drv) {
bool ble_init(void) {
ble_driver_t *drv = &g_ble_driver;
+
+ if (drv->initialized) {
+ return true;
+ }
+
memset(drv, 0, sizeof(*drv));
sock_init(&drv->data_sock);
sock_init(&drv->event_sock);
### core/embed/projects/bootloader/main.c
@@ -530,7 +530,6 @@ int bootloader_main(void) {
erase_storage(NULL);
#ifdef USE_BLE
- ble_init();
ble_wait_until_ready();
wipe_bonds(NULL);
#endifWhy this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.