[PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

btd_service_disconnect may cause a service to disconnect before returning
which cause dev->disconnect to be set after device_profile_disconnected.
---
 src/device.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index d7a00ec..953a338 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1434,11 +1434,14 @@ static DBusMessage *disconnect_profile(DBusConnection *conn, DBusMessage *msg,
 	if (!service)
 		return btd_error_invalid_args(msg);
 
+	dev->disconnect = dbus_message_ref(msg);
+
 	err = btd_service_disconnect(service);
-	if (err == 0) {
-		dev->disconnect = dbus_message_ref(msg);
+	if (err == 0)
 		return NULL;
-	}
+
+	dbus_message_unref(dev->disconnect);
+	dev->disconnect = NULL;
 
 	if (err == -ENOTSUP)
 		return btd_error_not_supported(msg);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux