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] ofono: Fix segfault during modem_removed (Lukasz Nowak)
   2. [PATCH] ofono: Fix shared usage of interface index (Lukasz Nowak)


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

Message: 1
Date: Fri, 31 Mar 2017 15:37:49 +0100
From: Lukasz Nowak <[email protected]>
To: [email protected]
Subject: [PATCH] ofono: Fix segfault during modem_removed
Message-ID: <[email protected]>

From: Lukasz Nowak <[email protected]>

Prevent sending any further dbus messages after modem_removed signal.

Sequence causing a segfault is:
- modem_removed
- remove_modem
- remove_all_contexts
- remove_cm_context
- remove_network
- connman_device_remove_network
- network_disconnect
- context_set_active
- set_property
---
 plugins/ofono.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 70b085a..f6b2b52 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -2500,16 +2500,19 @@ static void remove_modem(gpointer data)
        if (modem->call_set_property) {
                dbus_pending_call_cancel(modem->call_set_property);
                dbus_pending_call_unref(modem->call_set_property);
+               modem->call_set_property = NULL;
        }
 
        if (modem->call_get_properties) {
                dbus_pending_call_cancel(modem->call_get_properties);
                dbus_pending_call_unref(modem->call_get_properties);
+               modem->call_get_properties = NULL;
        }
 
        if (modem->call_get_contexts) {
                dbus_pending_call_cancel(modem->call_get_contexts);
                dbus_pending_call_unref(modem->call_get_contexts);
+               modem->call_get_contexts = NULL;
        }
 
        /* Must remove the contexts before the device */
@@ -2699,6 +2702,9 @@ static int network_connect(struct connman_network 
*network)
 
        DBG("%s network %p", modem->path, network);
 
+       if (!g_hash_table_lookup(modem_hash, modem->path))
+               return -ENODEV;
+
        context = get_context_with_network(modem->context_list, network);
        if (!context)
                return -ENODEV;
@@ -2720,6 +2726,9 @@ static int network_disconnect(struct connman_network 
*network)
 
        DBG("%s network %p", modem->path, network);
 
+       if (!g_hash_table_lookup(modem_hash, modem->path))
+               return -ENODEV;
+
        context = get_context_with_network(modem->context_list, network);
        if (!context)
                return -ENODEV;
-- 
2.7.4



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

Message: 2
Date: Fri, 31 Mar 2017 18:00:43 +0100
From: Lukasz Nowak <[email protected]>
To: [email protected]
Subject: [PATCH] ofono: Fix shared usage of interface index
Message-ID: <[email protected]>

From: Lukasz Nowak <[email protected]>

IPv4 and IPv6 share the interface index value in the network_context structure.
Because of that, they should not overwrite it with -1 every time a Settings
or IPv6.Setting modem property is received.

Problem observed when a modem was first reporting IPv4 Settings, with a valid
interface name and method dhcp. And then IPv6.Settings with method=OFF and
no interface name.

In that case, extract_ipv6_settings would wrongly set context->index = -1
causing the set_connected() fail and modem being incorrectly kept disconnected.
---
 plugins/ofono.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index f6b2b52..78f8f19 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -841,7 +841,6 @@ static void extract_ipv4_settings(DBusMessageIter *array,
 
        connman_ipaddress_free(context->ipv4_address);
        context->ipv4_address = NULL;
-       context->index = -1;
 
        if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
                return;
@@ -944,7 +943,6 @@ static void extract_ipv6_settings(DBusMessageIter *array,
 
        connman_ipaddress_free(context->ipv6_address);
        context->ipv6_address = NULL;
-       context->index = -1;
 
        if (dbus_message_iter_get_arg_type(array) != DBUS_TYPE_ARRAY)
                return;
-- 
2.7.4



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

Subject: Digest Footer

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


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

End of connman Digest, Vol 17, Issue 23
***************************************

Reply via email to