Skip to content
  • Frédéric Danis's avatar
    bluetooth: Fix crash when disabling Bluetooth adapter · f89d64b9
    Frédéric Danis authored and Tanu Kaskinen's avatar Tanu Kaskinen committed
    This crash occurs when PA is connected to a phone through the oFono
    backend.
    When disabling the Bluetooth adapter, pa_bluetooth_device is removed before
    hf_audio_card. Both keep refs on pa_bluetooth_transport. Those removal will
    call pa_bluetooth_transport_free() from device_free() (bluez5-util.c) and
    hf_audio_card_free() (backend-ofono.c).
    In the end, the call to pa_bluetooth_transport_free() calls
    pa_hasmap_remove() through pa_bluetooth_transport_unlink(), but since
    memory has already been freed, the second try results in a segfault.
    
    Triggering hf_audio_card removal during pa_bluetooth_device removal allows
    hf_audio_card to be freed at the right time.
    f89d64b9