Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH 2/2] ofono: removing contexts requires a careful list
      walk (Jonas Bonn)
   2. [PATCH 1/2] device: fix enable/disable return code (Jonas Bonn)


----------------------------------------------------------------------

Message: 1
Date: Sat,  9 Dec 2017 15:13:35 +0100
From: Jonas Bonn <[email protected]>
To: [email protected]
Subject: [PATCH 2/2] ofono: removing contexts requires a careful list
        walk
Message-ID: <[email protected]>

The function remove_cm_context() modifies the context_list so the
list->next pointer is no longer valid on its return.

With this patch, we _carefully_ iterate over the context_list, assuming
that it may have been modified on each iteration.

Without this patch, only the first context in the list is successfully
removed; after that the behaviour is somewhat unpredictable!  What I was
seeing was that services coupled to the second context were never
destroyed resulting in available services without a proper backing
device.
---
 plugins/ofono.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 78f8f196..82413b6e 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -1301,10 +1301,13 @@ static void remove_all_contexts(struct modem_data 
*modem)
        if (modem->context_list == NULL)
                return;
 
-       for (list = modem->context_list; list; list = list->next) {
+       list = modem->context_list;
+       while (list) {
                struct network_context *context = list->data;
 
                remove_cm_context(modem, context);
+
+               list = modem->context_list;
        }
        g_slist_free(modem->context_list);
        modem->context_list = NULL;
-- 
2.14.1



------------------------------

Message: 2
Date: Sat,  9 Dec 2017 15:13:34 +0100
From: Jonas Bonn <[email protected]>
To: [email protected]
Subject: [PATCH 1/2] device: fix enable/disable return code
Message-ID: <[email protected]>

The powered_pending status is an indication that the powered status is
in the process of being changed; the correct return code here should be
"in progress".

Without this patch, setting a technology "Powered" for a slow ofono
device in the process of powering up results in an immediate DBus
response even though the device is far from being ready.

With this patch, setting a technology "Powered" returns first when the
property has actually changed which is the desired behaviour.
---
 src/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index a563f464..10fa64ac 100644
--- a/src/device.c
+++ b/src/device.c
@@ -179,7 +179,7 @@ int __connman_device_enable(struct connman_device *device)
                return -EBUSY;
 
        if (device->powered_pending == PENDING_ENABLE)
-               return -EALREADY;
+               return -EINPROGRESS;
 
        if (device->powered_pending == PENDING_NONE && device->powered)
                return -EALREADY;
@@ -230,7 +230,7 @@ int __connman_device_disable(struct connman_device *device)
                return -EBUSY;
 
        if (device->powered_pending == PENDING_DISABLE)
-               return -EALREADY;
+               return -EINPROGRESS;
 
        if (device->powered_pending == PENDING_NONE && !device->powered)
                return -EALREADY;
-- 
2.14.1



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 26, Issue 9
**************************************

Reply via email to