* [PATCH BlueZ] mesh: Fix logic when cleaning up incomplete provisioning
@ 2019-01-19 6:53 Inga Stotland
2019-01-22 20:50 ` Gix, Brian
0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2019-01-19 6:53 UTC (permalink / raw)
To: linux-bluetooth; +Cc: brian.gix, Inga Stotland
Do not call acceptor_cancel() if the provisioning has been completed,
either fail or success. Acceptor automatically takes care of cleanup
on completion, either successful or not.
---
mesh/mesh.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/mesh/mesh.c b/mesh/mesh.c
index a1c26e77c..881b6ed73 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -354,8 +354,6 @@ static void free_pending_join_call(bool failed)
l_dbus_remove_watch(dbus_get_bus(),
join_pending->disc_watch);
- acceptor_cancel(&mesh);
-
mesh_agent_remove(join_pending->agent);
if (failed) {
@@ -375,11 +373,14 @@ void mesh_cleanup(void)
mgmt_unref(mgmt_mesh);
if (join_pending) {
- /* The Join() call failed since it has not been completed */
- reply = dbus_error(join_pending->msg, MESH_ERROR_FAILED,
+
+ if (join_pending->msg) {
+ reply = dbus_error(join_pending->msg, MESH_ERROR_FAILED,
"Failed. Exiting");
- l_dbus_send(dbus_get_bus(), reply);
+ l_dbus_send(dbus_get_bus(), reply);
+ }
+ acceptor_cancel(&mesh);
free_pending_join_call(true);
}
@@ -428,6 +429,7 @@ static void prov_disc_cb(struct l_dbus *bus, void *user_data)
if (join_pending->msg)
l_dbus_message_unref(join_pending->msg);
+ acceptor_cancel(&mesh);
join_pending->disc_watch = 0;
free_pending_join_call(true);
--
2.17.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH BlueZ] mesh: Fix logic when cleaning up incomplete provisioning
2019-01-19 6:53 [PATCH BlueZ] mesh: Fix logic when cleaning up incomplete provisioning Inga Stotland
@ 2019-01-22 20:50 ` Gix, Brian
0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2019-01-22 20:50 UTC (permalink / raw)
To: Stotland, Inga, linux-bluetooth
patch applied
> -----Original Message-----
> From: Stotland, Inga
> Sent: Friday, January 18, 2019 10:53 PM
> To: linux-bluetooth@vger.kernel.org
> Cc: Gix, Brian <brian.gix@intel.com>; Stotland, Inga
> <inga.stotland@intel.com>
> Subject: [PATCH BlueZ] mesh: Fix logic when cleaning up incomplete
> provisioning
>
> Do not call acceptor_cancel() if the provisioning has been completed, either
> fail or success. Acceptor automatically takes care of cleanup on completion,
> either successful or not.
> ---
> mesh/mesh.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/mesh/mesh.c b/mesh/mesh.c
> index a1c26e77c..881b6ed73 100644
> --- a/mesh/mesh.c
> +++ b/mesh/mesh.c
> @@ -354,8 +354,6 @@ static void free_pending_join_call(bool failed)
> l_dbus_remove_watch(dbus_get_bus(),
> join_pending->disc_watch);
>
> - acceptor_cancel(&mesh);
> -
> mesh_agent_remove(join_pending->agent);
>
> if (failed) {
> @@ -375,11 +373,14 @@ void mesh_cleanup(void)
> mgmt_unref(mgmt_mesh);
>
> if (join_pending) {
> - /* The Join() call failed since it has not been completed */
> - reply = dbus_error(join_pending->msg,
> MESH_ERROR_FAILED,
> +
> + if (join_pending->msg) {
> + reply = dbus_error(join_pending->msg,
> MESH_ERROR_FAILED,
> "Failed. Exiting");
> - l_dbus_send(dbus_get_bus(), reply);
> + l_dbus_send(dbus_get_bus(), reply);
> + }
>
> + acceptor_cancel(&mesh);
> free_pending_join_call(true);
> }
>
> @@ -428,6 +429,7 @@ static void prov_disc_cb(struct l_dbus *bus, void
> *user_data)
> if (join_pending->msg)
> l_dbus_message_unref(join_pending->msg);
>
> + acceptor_cancel(&mesh);
> join_pending->disc_watch = 0;
>
> free_pending_join_call(true);
> --
> 2.17.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-22 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-19 6:53 [PATCH BlueZ] mesh: Fix logic when cleaning up incomplete provisioning Inga Stotland
2019-01-22 20:50 ` Gix, Brian
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).