gatt: Fix Acquire* reply handling
Luiz Augusto von Dentz
maintainerPATCH 1/1 gatt: Fix Acquire* reply handling
From: Luiz Augusto von Dentz <[email protected]>
Originally these operation did not set any owner_queue which caused them to crash if the attribute is freed before the respose, to fix that the reply will now check if owner_queue was reset to NULL which means the attribute is no longer available but the owner_queue was never set in the first place so this ensures they are now setup properly.
--- src/gatt-database.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
src/gatt-database.c +3 -2
@@ -2485,8 +2485,8 @@ static struct pending_op *acquire_write(struct external_chrc *chrc, {struct pending_op *op; - op =pending_write_new (device,NULL , attrib, id, value, len,0 , - link_type, false, false); + op =pending_write_new (device, chrc->pending_writes, attrib, id, value, + len,0 , link_type, false, false); if (g_dbus_proxy_method_call(chrc->proxy, "AcquireWrite", acquire_write_setup,
@@ -2618,6 +2618,7 @@ static uint8_t ccc_write_cb(struct pending_op *op, void *user_data)if (g_dbus_proxy_get_property (chrc->proxy,"NotifyAcquired" , &iter)) { op->data.iov_base = (void *) chrc; op->data.iov_len =sizeof (chrc); + op->owner_queue = chrc->pending_writes; if (g_dbus_proxy_method_call(chrc->proxy, "AcquireNotify", acquire_notify_setup, acquire_notify_reply,
Signature · 1 line
2.21.1
Hi Luiz,
Quoted 16 lines · On Thursday, 2 April 2020 01:27:33 CEST Luiz Augusto von Dentz wrote:
From: Luiz Augusto von Dentz <[email protected]>
Originally these operation did not set any
owner_queuewhich caused them to crash if the attribute is freed before the respose, to fix that the reply will now check ifowner_queuewas reset to NULL which means the attribute is no longer available but theowner_queuewas never set in the first place so this ensures they are now setup properly.--- src/gatt-database.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)src/gatt-database.c +0
-0
src/gatt-database.c static struct pending_op *acquire_write(struct · line 2489
Quoted 5 lines
src/gatt-database.c +0
-2@@ -2485,8 +2485,8 @@ static struct pending_op *acquire_write(struct external_chrc *chrc, {struct pending_op *op; - op = pending_write_new(device, NULL, attrib, id, value, len, 0, - link_type, false,
false);
src/gatt-database.c static struct pending_op *acquire_write(struct · line 2488
Quoted 1 line
src/gatt-database.c +1
-0+ op = pending_write_new(device, chrc->pending_writes, attrib, id,
value,
src/gatt-database.c static uint8_t ccc_write_cb(struct pending_op *op, · line 2623
Quoted 11 lines
src/gatt-database.c +2
-0+ len, 0, link_type, false, false); if (g_dbus_proxy_method_call(chrc->proxy, "AcquireWrite", acquire_write_setup,@@ -2618,6 +2618,7 @@ static uint8_t ccc_write_cb(struct pending_op *op, void *user_data) if (g_dbus_proxy_get_property(chrc->proxy,"NotifyAcquired" , &iter)) { op->data.iov_base = (void *) chrc; op->data.iov_len =sizeof (chrc); + op->owner_queue = chrc->pending_writes; if (g_dbus_proxy_method_call(chrc->proxy, "AcquireNotify",
acquire_notify_setup,
Quoted 1 line
acquire_notify_reply,
Patch applied, thanks.
Signature · 2 lines
pozdrawiam Szymon Janc