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
disconnect.

BUG=537697

Change-Id: I29bb303f307ee3e895d29c3d33a6e5ee910348a8
Reviewed-on: https://chromium-review.googlesource.com/305223
Commit-Ready: Jakub x Jakub Pawlowski <jpawlowski@chromium.org>
Tested-by: Jakub x Jakub Pawlowski <jpawlowski@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Reviewed-by: Jakub x Jakub Pawlowski <jpawlowski@chromium.org>
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)
 		browse_request_cancel(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,
 								"Cancelled");