diff mbox series

[BlueZ] device: Fix crash when removing device

Message ID 20220210221451.418234-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ] device: Fix crash when removing device | expand

Commit Message

Luiz Augusto von Dentz Feb. 10, 2022, 10:14 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Calling btd_adapter_remove_device from device_remove_connection can
cause a crash, so instead of removing it immediatelly this set a the
temporary timeout to 0.

Fixes: https://github.com/bluez/bluez/issues/290
---
 src/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 6d29eb896..b5a47d302 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3285,7 +3285,7 @@  void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 						DEVICE_INTERFACE, "Connected");
 
 	if (remove_device)
-		btd_adapter_remove_device(device->adapter, device);
+		set_temporary_timer(device, 0);
 }
 
 guint device_add_disconnect_watch(struct btd_device *device,