linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v0] gatt: Fix not replying for write requests
@ 2014-04-17 14:19 Claudio Takahasi
  2014-04-22 11:34 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2014-04-17 14:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Attributes should not be unregistered dynamically unless the service
implementation calls UnregisterService() or leave the system bus.
Implementations may accidentally (or maliciously) unregister a GATT
object (characteristic or descriptor) belonging to a service hierarchy.
gdbus automatically tracks InterfacesRemoved() signal, and destroys the
GDBusProxy associated with the removed interfaces. Subsequent calls of
g_dbus_proxy_set_property_array() returns FALSE, and it needs to be
handled properly since the GDBusProxy result callback will not be called.
---
 src/gatt-dbus.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gatt-dbus.c b/src/gatt-dbus.c
index 26437e7..c22e8af 100644
--- a/src/gatt-dbus.c
+++ b/src/gatt-dbus.c
@@ -332,9 +332,13 @@ static void proxy_write_cb(struct btd_attribute *attr,
 		wdata->result_cb = result;
 		wdata->user_data = user_data;
 
-		g_dbus_proxy_set_property_array(proxy, "Value", DBUS_TYPE_BYTE,
-						value, len, proxy_write_reply,
-						wdata, g_free);
+		if (!g_dbus_proxy_set_property_array(proxy, "Value",
+						DBUS_TYPE_BYTE, value, len,
+						proxy_write_reply,
+						wdata, g_free)) {
+			g_free(wdata);
+			result(-ENOENT, user_data);
+		}
 	} else {
 		/*
 		 * Caller is not interested in the Set method call result.
-- 
1.8.3.1


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

* Re: [PATCH BlueZ v0] gatt: Fix not replying for write requests
  2014-04-17 14:19 [PATCH BlueZ v0] gatt: Fix not replying for write requests Claudio Takahasi
@ 2014-04-22 11:34 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2014-04-22 11:34 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Thu, Apr 17, 2014, Claudio Takahasi wrote:
> Attributes should not be unregistered dynamically unless the service
> implementation calls UnregisterService() or leave the system bus.
> Implementations may accidentally (or maliciously) unregister a GATT
> object (characteristic or descriptor) belonging to a service hierarchy.
> gdbus automatically tracks InterfacesRemoved() signal, and destroys the
> GDBusProxy associated with the removed interfaces. Subsequent calls of
> g_dbus_proxy_set_property_array() returns FALSE, and it needs to be
> handled properly since the GDBusProxy result callback will not be called.
> ---
>  src/gatt-dbus.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2014-04-22 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-17 14:19 [PATCH BlueZ v0] gatt: Fix not replying for write requests Claudio Takahasi
2014-04-22 11:34 ` 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).