Hi Lukasz,
On 03/31/2017 04:37 PM, Lukasz Nowak wrote:
From: Lukasz Nowak <lnowak(a)tycoint.com>
Prevent sending any further dbus messages after modem_removed signal.
I presume that is the part with the g_hash_table_lookup()? Mixing this
with the segfault fix is a bit confusing. Could you split this into two
patches?
Thanks,
Daniel
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;