From 50fc46c17089fbb55595327a5c3fc82d83f792fd Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 3 May 2019 18:07:33 +0200 Subject: [PATCH] bearer-qmi: do not call cleanup_event_report_unsolicited_events() w/o indication_id If a disconnection fails (because stop_network() failed), base-bearer flips the state back to CONNECTED. Oops. At that point something is clearly messed up, but it seems correct to assume the bearer is connected. Nevertheless, we will have already have unhooked the unsolicited events reporting. A subsequent attempt to disconnect the bearer will trip the assertion: #0 0x00007ffff75f2eb5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007ffff75dd895 in __GI_abort () at abort.c:79 #2 0x00007ffff77beb53 in g_assertion_message (domain=, file=, line=, func=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", message=) at ../glib/gtestutils.c:2878 #3 0x00007ffff781a96f in g_assertion_message_expr (domain=domain@entry=0x0, file=file@entry=0x507aad "mm-bearer-qmi.c", line=line@entry=1138, func=func@entry=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", expr=expr@entry=0x507ae5 "*indication_id != 0") at ../glib/gtestutils.c:2904 #4 0x00000000004a0c49 in cleanup_event_report_unsolicited_events (client=, indication_id=0x5bb30c, self=) at mm-bearer-qmi.c:1138 #5 0x00000000004a0c49 in cleanup_event_report_unsolicited_events (client=, indication_id=indication_id@entry=0x5bb30c, self=0x5bb420 [MMBearerQmi]) at mm-bearer-qmi.c:1132 #6 0x00000000004a0ee3 in disconnect_context_step (task=0x7fffe8012100 [GTask]) at mm-bearer-qmi.c:1854 #7 0x000000000046e889 in disconnect_auth_ready (self=, res=, ctx=ctx@entry=0x654630) at mm-iface-modem-simple.c:865 #8 0x00007ffff79cfa9a in g_task_return_now (task=0x7fffe8012640 [GTask]) at ../gio/gtask.c:1209 ... Add checks for indication_id to calls to cleanup_event_report_unsolicited_events() on DISCONNECT_STEP_STOP_NETWORK_IPV4 or DISCONNECT_STEP_STOP_NETWORK_IPV6, as is done elsewhere. --- src/mm-bearer-qmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index cfeac6e2..8815122f 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -1849,9 +1849,10 @@ disconnect_context_step (GTask *task) ctx->client_ipv4, FALSE, &self->priv->packet_service_status_ipv4_indication_id); - cleanup_event_report_unsolicited_events (self, - ctx->client_ipv4, - &self->priv->event_report_ipv4_indication_id); + if (self->priv->event_report_ipv4_indication_id) + cleanup_event_report_unsolicited_events (self, + ctx->client_ipv4, + &self->priv->event_report_ipv4_indication_id); input = qmi_message_wds_stop_network_input_new (); qmi_message_wds_stop_network_input_set_packet_data_handle (input, ctx->packet_data_handle_ipv4, NULL); @@ -1878,9 +1879,10 @@ disconnect_context_step (GTask *task) ctx->client_ipv6, FALSE, &self->priv->packet_service_status_ipv6_indication_id); - cleanup_event_report_unsolicited_events (self, - ctx->client_ipv6, - &self->priv->event_report_ipv6_indication_id); + if (self->priv->event_report_ipv6_indication_id) + cleanup_event_report_unsolicited_events (self, + ctx->client_ipv6, + &self->priv->event_report_ipv6_indication_id); input = qmi_message_wds_stop_network_input_new (); qmi_message_wds_stop_network_input_set_packet_data_handle (input, ctx->packet_data_handle_ipv6, NULL);