UPSTREAM: core/device: Fix disconnect for connect attempt

Right now calling Disconnect from DBus on device that's not advertising
or out of sight will not stop the connect attempt in kernel. This patch
fixes that by making sure that att_io is properly cleaned up on


Change-Id: I29bb303f307ee3e895d29c3d33a6e5ee910348a8
Commit-Ready: Jakub x Jakub Pawlowski <>
Tested-by: Jakub x Jakub Pawlowski <>
Reviewed-by: Arman Uguray <>
Reviewed-by: Jakub x Jakub Pawlowski <>
diff --git a/src/device.c b/src/device.c
index 3d23b34..6c3a12d 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1355,6 +1355,12 @@
 	if (device->browse)
+	if (device->att_io) {
+		g_io_channel_shutdown(device->att_io, FALSE, NULL);
+		g_io_channel_unref(device->att_io);
+		device->att_io = NULL;
+	}
 	if (device->connect) {
 		DBusMessage *reply = btd_error_failed(device->connect,