[PATCH] bluetooth: Free backends before devices and adapters.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2018-06-28 at 14:58 +0300, Juho Hämäläinen wrote:
> When bluetooth daemon disappears gracefully transports are freed before
> the daemon disappears from DBus bus. However if bluetooth daemon
> segfaults or is killed abruptly the daemon disappears from the bus
> before PulseAudio is able to clean the transports. As the devices
> and adapters are freed before ofono or native backends, PulseAudio
> segfaults when dangling pointers are used when freeing the backends.
> Fix by freeing the backends before devices and adapters when bluetooth
> daemon disappears from DBus bus.
> 
> Signed-off-by: Juho Hämäläinen <jusa at hilvi.org>
> ---
>  src/modules/bluetooth/bluez5-util.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

I suppose it's the hf_audio_card.transport pointers that are dangling?

Rather than having unobvious ordering requirements, it would seem
better to me to notify the backends when the transports are freed so
that they can drop their references. There's already the destroy()
callback that could be used for this. What do you think?

(Sidenote: the transport ownership semantics are pretty messy. The
backends call transport_new(), but they don't necessarily call
transport_free(). I guess this is justifiable, because the transports
have to be freed when devices are freed anyway, so to fix this there
would have to be some kind of callback that device_free() would call,
and the callback would just call transport_free(), so maybe it's fine
that we currently cut the complexity by calling transport_free()
directly from device_free()...)

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux