linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile
@ 2013-12-10  8:41 Luiz Augusto von Dentz
  2013-12-10  8:41 ` [PATCH BlueZ 2/2] core: Fix leaking disconnect message Luiz Augusto von Dentz
  2013-12-10  9:32 ` [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2013-12-10  8:41 UTC (permalink / raw)
  To: linux-bluetooth

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

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH BlueZ 2/2] core: Fix leaking disconnect message
  2013-12-10  8:41 [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile Luiz Augusto von Dentz
@ 2013-12-10  8:41 ` Luiz Augusto von Dentz
  2013-12-10  9:32 ` [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2013-12-10  8:41 UTC (permalink / raw)
  To: linux-bluetooth

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

If a disconnect message is pending return an error since currently the
code cannot process it in parallel.
---
 src/device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/device.c b/src/device.c
index 953a338..18543ee 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1434,6 +1434,9 @@ static DBusMessage *disconnect_profile(DBusConnection *conn, DBusMessage *msg,
 	if (!service)
 		return btd_error_invalid_args(msg);
 
+	if (dev->disconnect)
+		return btd_error_in_progress(msg);
+
 	dev->disconnect = dbus_message_ref(msg);
 
 	err = btd_service_disconnect(service);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile
  2013-12-10  8:41 [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile Luiz Augusto von Dentz
  2013-12-10  8:41 ` [PATCH BlueZ 2/2] core: Fix leaking disconnect message Luiz Augusto von Dentz
@ 2013-12-10  9:32 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2013-12-10  9:32 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Tue, Dec 10, 2013, Luiz Augusto von Dentz wrote:
> 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(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-10  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10  8:41 [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile Luiz Augusto von Dentz
2013-12-10  8:41 ` [PATCH BlueZ 2/2] core: Fix leaking disconnect message Luiz Augusto von Dentz
2013-12-10  9:32 ` [PATCH BlueZ 1/2] core: Fix not replying to DisconnectProfile Johan Hedberg

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