From 31f108aee1f328c8889b00547b212c4e3cb27fa2 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 3 May 2019 18:07:33 +0200
Subject: [PATCH 2/4] bearer-qmi: unsolicited events might not be enabled on
disconnect
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 eventsx
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=<optimized out>, file=<optimized out>, line=<optimized out>, func=0x5088e0 <__FUNCTION__.56253> "cleanup_event_report_unsolicited_events", message=<optimized out>) 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=<optimized out>, indication_id=0x5bb30c, self=<optimized out>)
at mm-bearer-qmi.c:1138
#5 0x00000000004a0c49 in cleanup_event_report_unsolicited_events
(client=<optimized out>, 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=<optimized out>, res=<optimized out>, 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
...
---
src/mm-bearer-qmi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index c75d5e4..f8c6544 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -970,7 +970,11 @@ cleanup_event_report_unsolicited_events (MMBearerQmi *self,
{
QmiMessageWdsSetEventReportInput *input;
- g_assert (*indication_id != 0);
+ if (*indication_id == 0) {
+ mm_warn ("Reporting of unsolicited events already cleared");
+ return;
+ }
+
g_signal_handler_disconnect (client, *indication_id);
*indication_id = 0;
--
1.8.3.1