linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arik Nemtsov <arik@wizery.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Arik Nemtsov <arik@wizery.com>
Subject: [PATCH 2/2] Revert "core: Add provision for terminating an ATT connection"
Date: Thu,  8 Mar 2012 15:44:39 +0200	[thread overview]
Message-ID: <1331214279-27521-2-git-send-email-arik@wizery.com> (raw)
In-Reply-To: <1331214279-27521-1-git-send-email-arik@wizery.com>

This reverts commit f89a77478af78d41c80ab7605662382b9e4e1c36.

This is not needed and actually introduces a bug. When the "Disconnect"
API of device is called device->attrib is unref-ed via a watch set on
G_IO_HUP. The channel is shutdown when the last reference is removed.

The code introduced here shuts down the channel and prevents the watch
from getting called. This means we leak a reference to device->attrib.
This can cause a number of bad things. For example, if the device is
temporary, it will never be freed, and we won't be able to pair to it
again.
---
 src/device.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/device.c b/src/device.c
index b339ac1..0a1de7c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -821,14 +821,6 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
 		browse_request_cancel(device->browse);
 	}
 
-	if (device->attrib) {
-		GIOChannel *io = g_attrib_get_channel(device->attrib);
-		if (io) {
-			g_io_channel_shutdown(io, FALSE, NULL);
-			g_io_channel_unref(io);
-		}
-	}
-
 	if (msg)
 		device->disconnects = g_slist_append(device->disconnects,
 						dbus_message_ref(msg));
-- 
1.7.5.4


  reply	other threads:[~2012-03-08 13:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 13:44 [PATCH 1/2] device: don't auto-connect on disc-cb attio callback registration Arik Nemtsov
2012-03-08 13:44 ` Arik Nemtsov [this message]
2012-03-08 13:47   ` [PATCH 2/2] Revert "core: Add provision for terminating an ATT connection" Arik Nemtsov
2012-03-14 12:08   ` Anderson Lizardo
2012-03-14 12:11     ` Arik Nemtsov
2012-03-14 12:40       ` Anderson Lizardo
2012-03-14 12:03 ` [PATCH 1/2] device: don't auto-connect on disc-cb attio callback registration Anderson Lizardo
2012-03-14 12:09   ` Arik Nemtsov
2012-03-14 12:49     ` Anderson Lizardo
2012-03-15 10:13 ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331214279-27521-2-git-send-email-arik@wizery.com \
    --to=arik@wizery.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).